This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "cannot run C compiled programs" error


On Tue, Apr 26, 2011 at 8:55 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>>
>>> [SNIP]
>>>
>>> Please try to reproduce the error with a minimal example to show
>>> whether you get that error just from including a header, or only under
>>> certain circumstances.
>>
>> I managed to track it down to the following test.cpp file:
>>
>> #include <cmath>
>> #include <mgl/mgl.h>
>> #include <algorithm>
>>
>> Where mgl is from the wxWidgets library, version 2.8.11
>>
>> When I changed the order to:
>> #include <cmath>
>> #include <algorithm>
>> #include <mgl/mgl.h>
>>
>> It worked.
>
> That would imply the mgl.h header does something it shouldn't, such as
> defining isnan as a macro, or something else which breaks the standard
> library header.
>
I've also seen similar in the past. I seem to recall (like Anna) that
the C++ gear had to be included before [some of] the standard linux
stuff such as sys/types, sys/socket.h, and netinet/in.h. Fortunately,
the standard linux headers do a good job of guarding for multiple
definitions (when they follow C++ headers). The C++ headers, on the
other hand, do not always do a good job (when they follow standard
headers).

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]