Author Topic: compiling problem in Linux (Fedora) - possibly preprocessor?  (Read 11111 times)

Offline recobb

  • Multiple posting newcomer
  • *
  • Posts: 30
compiling problem in Linux (Fedora) - possibly preprocessor?
« on: October 27, 2010, 03:02:22 pm »
I've posted this in the Fedora forums and gotten no response.  It's hard to say which part of the system is the problem - the gcc suite, code::blocks, or wxwidgets.  Here's the problem:

I have been spending several days getting wxwidgets to work in code::blocks ide on several different platforms. Now I am down to one instance that I can't figure out. I have wxwidgets working in Fedora 13 x64, but cannot get it to work in a Fedora 13 x32 version. Actually, wxwidgets seem to be installed OK, but I run into compiler errors when I try to compile the default wxhello project. I get quite a few messages, in different header files, of this type:

/usr/include/assert.h:39:42: error: missing binary operator before token "("
#if defined __cplusplus && __GNUC_PREREQ (2,95)

From my friend Google this would seem to be caused by an older version of boost (before 1.37) - see http://bugs.xmms2.xmms.se/view.php?id=2215
("It is an issue with old versions of boost and gcc4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36453
It is fixed in boost 1.37")

I did a yum info command on both systems for every relevant package I could think of, including gcc(v4.4.4), gcc-c++(4.4.4), libgcc(4.4.4), libstdc++(4.4.4), boost(1.41.0), wxGTK(2.8.11), wxBase(2.8.11). Both systems are fully updated and have the same versions, with the only difference being 32 vs 64 bit.

The same headers compile with no errors on the x64 system, but not x32. I have been able to find no other reason for this error than older versions of the preprocessor, yet that is apparently not the case here).

One more bit of info - I included one of the same include files (assert.h) in a working c program that I compiled from the command line using gcc, and it had no problem with the macro definition line.  This problem, so far, appears only when I'm compiling a wxwidgets app within code::blocks.  Gcc is the only compiler on my system, and that is what is chosen for the project.

Thanks for any help/insight.

Richard C.
« Last Edit: October 27, 2010, 04:35:19 pm by recobb »

Offline Folco

  • Regular
  • ***
  • Posts: 343
    • Folco's blog (68k lover)
Re: compiling problem in Linux (Fedora) - possibly preprocessor?
« Reply #1 on: October 27, 2010, 07:12:11 pm »
Perhaps you could use compiled nightlies ?
http://fedora.danny.cz/danny/
Kernel Extremist - PedroM power ©

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7786
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline recobb

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: compiling problem in Linux (Fedora) - possibly preprocessor?
« Reply #3 on: October 28, 2010, 03:40:06 pm »
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

OK, thanks for the suggestion.  I did that, and the process does not get far:
-------------- Build: Debug in hello_32 ---------------

g++ -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread  -Wall  -g    -I/usr/include/wx-2.8/wx -I/usr/lib/wx  -c /home/rec/wxproj/hello_32/GUIFrame.cpp -o obj/Debug/GUIFrame.o
In file included from /usr/include/wx-2.8/wx/debug.h:18,
                 from /usr/include/wx-2.8/wx/defs.h:521,
                 from /usr/include/wx-2.8/wx/wxprec.h:13,
                 from /home/rec/wxproj/hello_32/GUIFrame.cpp:8:
/usr/include/assert.h:39:42: error: missing binary operator before token "("


So I copied the command line to a terminal window and tried removing various parts until that particular error message no longer appeared.  I found that by removing the include '-I/usr/include/wx-2.8/wx' (after the -g flag), that  that particular error message went away.  Which simply confirms what the error messages above were telling me about the location of the file causing the problem, I realize.

I used locate to find assert.h, which returned /usr/include/assert.h   When I opened this file the line number and character position agree with the error message for the location of the "(".

This is the same assert.h that was included in other compiles of a different program, without errors.  So I thought perhaps it was one of the flags that was invoked.  I reran with all the flags removed, only the include parts remaining:

g++ -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8  -g  -I/usr/include/wx-2.8/wx -I/usr/lib/wx  -c dysmashistory.c

I still received the same error, only in a different header this time:

/usr/include/sys/cdefs.h:46:44: error: missing binary operator before token "("

When I remove the include: -I/usr/include/wx-2.8/wx (actually, just the wx from the end of that include) , then the file compiles successfully and creates the .o object file.  So then I looked for how to remove that include path from within Code::blocks.  I checked wx-config --cflags and received:
[]$ wx-config --cflags
-I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
[]$ wx-config --libs
-pthread   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8


Except for the two wx-config lines in the Build Options dialog, the extra search paths and other settings, etc., are blank, so it is not getting the .../wx path from there.

So where do I go from here?  I've already gone beyond what I've previously figured out, thanks to your advice.  But I'm stuck again.

Thanks!

Richard







Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: compiling problem in Linux (Fedora) - possibly preprocessor?
« Reply #4 on: October 28, 2010, 03:50:16 pm »
Did you look at the global compiler optins in "Settings -> Compiler and debugger -> Global compiler settings -> GNU GCC Compiler" ?

Offline recobb

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: compiling problem in Linux (Fedora) - possibly preprocessor?
« Reply #5 on: October 28, 2010, 04:18:55 pm »
Did you look at the global compiler optins in "Settings -> Compiler and debugger -> Global compiler settings -> GNU GCC Compiler" ?

That was it.  It was listed under Compiler|Search directories.  I removed it and now the project builds and runs.

Many thanks!!

Richard