Compilation with local header

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
flopasi
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Mar 28, 2018 3:12 pm

Compilation with local header

Post by flopasi »

Hello,

I successfully compiled wxwidget statically.
I can use it in any project if I include and link it from where it has been compiled.

I can also use it if I move the static libraries around and change the linker path accordingly.

HOWEVER I can't manage to move (put in my source code) the wx include header
Using eclipse and those compiler options :

Code: Select all

-c -fmessage-length=0 -I/home/florian/workspace/lib/wxWidgets-3.0.3/gtk-build/lib/wx/include/gtk2-unicode-static-3.0 -I/home/florian/workspace/lib/wxWidgets-3.0.3/include -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
It works fine

But if the header are in my source code (copy and paste the two dirs) , and compiler options are :

Code: Select all

-c -fmessage-length=0 -I"${workspace_loc:/${ProjName}/lib/wx/lib/x64_linux/wx/include/gtk2-unicode-static-3.0}" -I"${workspace_loc:/${ProjName}/lib/wx/include}" -D_FILE_OFFSET_BITS=64 -D__WXGTK__ -pthread
That doesn't work, I get some
wxMutex’ does not name a type
and other classes undefined.

This doesn't make any sense to me as the include order and files are the exact same as well as the the compiler options order.

What am I missing ?
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Compilation with local header

Post by DavidHart »

Hi,

Your "${workspace_loc:/${ProjName}/lib/wx/lib/x64_linux/wx/include/gtk2-unicode-static-3.0}" looks weird, but anyway:

The standard method of getting its cxxflags and libs data from your target wx build is to use the wx-config script. Since you have (sensibly) created a 'local' wx build, the easiest way is to do things like:

Code: Select all

g++ foo.cpp bar.cpp $(/full/path/to/wx/build-dir/wx-config --libs --cxxflags) -o test
(if you do /full/path/to/wx/build-dir/wx-config in a terminal you'll see the output that you'd get.)

Alternatively, instead of using the full path each time you can prepend it to the PATH in the current terminal.

Regards,

David
Post Reply