Forum Discussion
Altera_Forum
Honored Contributor
19 years ago --- Quote Start --- originally posted by andy@Sep 6 2006, 03:18 PM 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
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=18107)
--- quote end ---
--- Quote End --- look at the "const" before your variable inistialization.