Author Topic: #include "glee.h" error: you need ISO C conforming compiler to use glibc headers  (Read 18099 times)

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
I have been developing a portable 3D game/graphics/simulation engine that runs on linux and windoze for some time, with the eclipse IDE in linux, and VisualStudio2005 in windoze.  Recently I got so frustrated with eclipse that I went looking for alternatives and found CodeBlocks.  To get up to speed, I tried to get a somewhat smaller project to compile and run, and with a little help from this forum, was successful.  What a relief to be able to ditch eclipse!  :-)

Then I tried to compile my 3D engine, but ran into an error that I am not smart enough to "make go away".  I find it a bit confusing, since eclipse is also running the same compiler (or at least both IDEs *say* the compiler is GCC), and as far as I can tell, all my settings are the same.  I have found that when I comment out the #include "glee.h" statement the problem I describe below goes away, but of course all the OpenGL functions generates errors (because the OpenGL functions are not defined).

The problem is this (when the #include "glee.h" is in the code).  It compiles a bunch of my files, then hits an error and stops.  The error it hits is in the "/usr/include/sys/cdefs.h" file on line 32, and the error message is "error: you need a ISO C conforming compiler to use glibc headers".  The following is the line where the error occurs (the middle line).  My program does not define either __GNUC__ or __STDC__, and apparently neither does the "glee.h" file - at least not directly (in the text of the "glee.h" file).

#if defined __GNUC__ && !defined __STDC__
# error "You need a ISO C conforming compiler to use the glibc headers"
#endif

In my eclipse version, I have two compiler switches defined, -traditional-cpp and -funsigned-char.  I try removing them, but that doesn't change this problem.  The only defines I have set in the CodeBlocks "build options" are two of my own, namely CPU32 and LINUX.  What am I missing?  I searched around the internet for an answer, but found nothing helpful.  Any ideas?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
I guess there must be an option in Eclipse to show the full command line being used to compile your files. C::B has such an option for sure. You could try comparing both command lines for the same file. There's a chance Eclipse adds a few more things to it, so it would be just a matter of adding those missing options to your project in C::B.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
In my eclipse version,
There is a nice plugin for Eclipse that allows exporting Eclipse projects to C::B. This is done by mariocup (search the forums accordingly...). You could try that one, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Quote
There's a chance Eclipse adds a few more things to it, so it would be just a matter of adding those missing options to your project in C::B.
You probably have added too many compiler options, some of which you haven't understood, because:
H:\>cpp -dM nul |grep STDC
#define __STDC_HOSTED__ 1
#define __STDC__ 1

If you don't do anything, __STDC__ is defined.

In general, apart from include directories, most programs should need few if any options to compile.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

mariocup

  • Guest
Hi Martin,

we are still working at the Eclipse to CB exporter and we will also fix add missing features reported from you.

I think a first version will be available in the middle of March. :D

Bye,

Mario

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Okay, I have reviewed the project settings and switches and such, and the only difference I can find between the invocation in eclipse and CodeBlocks is the following.  In eclipse, it compiles with the gcc compiler, but the actual invocation is "g++" instead of "gcc".  My understanding is "gcc" invokes "g++" anyway, but in CodeBlocks, I see no way to *force* the invocation of g++.  Instead, CodeBlocks gives me a pulldown list of compilers to choose from, gcc being one of the choices.  But I see nowhere to force CodeBlocks to invoke g++ versus gcc (or otherwise make the whatever distinctions the g++ invocation might have.

While my common sense says, "it can't be this", I cannot find other differences.  One reason this seems like it is not the answer is what causes the problem, namely the "glee.h/glee.c" files... which are C, not C++.  In contrast, all my files are ".h/.cpp" files (without classes or templates or function overloading, however), which compile okay.  So, on the surface anyway, it seems that a C program is causing the problem, not C++.  But what do I know?  Obviously, not enough.

Offline bootstrap

  • Multiple posting newcomer
  • *
  • Posts: 64
Okay, finally I got it to compile (and run) successfully, not that I understand why.  First of all, I'm sure I "tried this before" and it didn't solve the problem before.  And second, now the situation is, I need a compiler flag on eclipse that breaks the compile on CodeBlocks!  Specifically, I need the -traditional-cpp on eclipse to compile successfully (or at least I used to, didn't actually reconfirm this just now), yet the -traditional-cpp flag on CodeBlocks causes the problem I described.  Play twilight-zone music here, briefly.  Perhaps the g++ invocation that I described in my previous message does relate to the significance of this compiler switch in some way.  Got me batman!  I want to report this finding for anyone who finds this message in the future someday (who has the same problem).  Thanks to everyone who replied to my post and gave suggestions.