Altera_Forum
Honored Contributor
19 years agoinitializer element is not a constant
How can I get rid of the following error: initializer element is not a constant?
I use NIOS II IDE in the C programming language. Before I had the code: # define ip1 134# define ip2 35# define ip3 134# define ip4 112 . . . const struct ip_settings eth_ip = { interfacetype, ((UINT32) ip4<<24 | ((UINT32) ip3 <<16) | ((UINT32)ip2<<8) |((UINT32) ip1 <<0)) } --- Now I want to reload the values for ip1, ip2,ip3 and ip4 during operation. So I put: int ip1 = 134; int ip2 = 35; int ip3 = 134; int ip4 = 112; instead of the defines. Compiling this leads to the error "initializer element is not a constant" http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif How do I get around without this error message? Thanks for your help in advance. andy