User forums > Help
Possible issue with GNU C flag option?
(1/1)
ToApolytoXaos:
Guys, I'm experimenting with GNU C and seems I have an issue with defined(__GNUC__).
The code works, but the editor grays it for some reason.
See the build log please
Cheers.
P.S.: I forgot to mention, this is under GNU / Linux Debian testing (jessie) with the latest updates and gcc (Debian 4.8.1-10) 4.8.1.
Alpha:
Settings->Editor->C/C++ Editor settings do you have 'Collect defines from project file' enabled?
ToApolytoXaos:
--- Quote from: Alpha on October 20, 2013, 03:46:52 pm ---Settings->Editor->C/C++ Editor settings do you have 'Collect defines from project file' enabled?
--- End quote ---
Thanks Alpha, it was disabled. I enabled it and now works just fine :) thanks a million mate, much appreciated.
UPDATE: For those who are interested in such things, the following code works flawlessly on Linux with GCC, without involving any extra flag option added, whereas on Windows with MinGW, you have to add -std=gnu90 to make it work IF you have -ansi flag turned on; else you may remove both flags and still will compile just fine.
Here's the code:
--- Code: (GNU C) ---#include <stdio.h>
#if defined(__GNUC__) && defined(__STDC__) && __STDC__
__extension__
__inline__ void
demo() {
int i;
for (i = 0; i < 10; i++) {
printf("[%d]: Demo!\n", i);
}
}
#endif
int main(void)
{
int i;
for (i = 0; i < 10; i++) {
printf("Executing the GNU C inlined function number #%d\n", i);
demo();
}
return 0;
}
--- End code ---
NOTE: On Windows this option is enabled by default, whereas on Linux it is not. Can we sync both versions' settings so they could behave if not alike, as closest as possible?
Navigation
[0] Message Index
Go to full version