Altera_Forum
Honored Contributor
20 years agoconditional compilation ?
Hello.
I'm working with two kits of development NIOSII. I wish to use the following conditional compilation in a common file (as user.h) : // --- choice of board ---------------------------------- # define NIOSII_1 //#define NIOSII_2 // --- choice of MAC address ------------------------- # ifdef NIOSII_1 # ifndef FLAG_ADRESSE_MAC_ETHERNET # define FLAG_ADRESSE_MAC_ETHERNET const char adresse_mac_ethernet[6] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06} ; # endif // FLAG_ADRESSE_MAC_ETHERNET # endif // NIOSII_1 # ifdef NIOSII_2 # ifndef FLAG_ADRESSE_MAC_ETHERNET # define FLAG_ADRESSE_MAC_ETHERNET const char adresse_mac_ethernet[6] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16} ; # endif // FLAG_ADRESSE_MAC_ETHERNET # endif // NIOSII_2 The result of compilation is : > obj/file.o *123: multiple definition of `adresse_mac_ethernet' ../file.c:218: first defined here Does conditional compilation function ? Or do I make an error ? Best regards bbo