Platform: Dual 2.3GHz PowerMac G5, Mac OSX 10.4.7, Xcode Tools 2.4. wxWidgets 2.6.3
Code::Blocks 1.0 revision 2913
I am an absolute beginner in C::B, I just got the application running on Mac OSX.
I created a new wxWidgets project and tried to build it, but it failed to find the header in
#include <wx/wxprec.h>
I have tried to understand how to set up global variable, but failed.
The particular file that was not found resides in
/opt/local/include/wx-2.6/wx/
The libwx* libraries are in
/opt/local/lib
Any hints?
The particular file that was not found resides in
/opt/local/include/wx-2.6/wx/
The libwx* libraries are in
/opt/local/lib
CFLAGS=`wx-config --cflags`
CXXFLAGS=`wx-config --cxxflags`
LDFLAGS=`wx-config --libs`
I normally use "wx-config" to find those.
Code:
CFLAGS=`wx-config --cflags`
CXXFLAGS=`wx-config --cxxflags`
LDFLAGS=`wx-config --libs`
Posted on: August 30, 2006, 04:19:14 PM
wx-config --cxxflags and friends, will give you the compiler flags required to build wxWidget projectsAbsolutely true.
you'll need to learn what are and where to put compiler flags if you don't know (and your questions makes me think so)
And since you're on mac... you could use the wx framework that comes with your computer with a single flag: -framework wxWidgets (or whatever it's called, i don't know, i don't have it on 10.3)
Since this is Code::Blocks forum, i'm assuming you're using Code::Blocks? Though it seems like you're on mac, and Code::Blocks for mac is kind of early and unstable.Do you suggest I get myself a WinPC and start learing Code::Blocks there, to get a feeling for the "normal" programming enviroment first?
If you really want to use it, then just find the area where compiler and linker flags go and paste the right flags there.Which brings me to the fundamental question:
Or use the wxWidgets project template.That's exactly what I did.
It works fine over here on 10.3.9 computer with wx 2.7. If it doesn't work for you it might be a hint that you didn't install wxWidgets properly? wx-config should really not cause problems... or maybe it's a 10.4 problemI have been using CodeWarrior C/C++ for true cross-platform applications on Mac and WinPC for about 15 years.
you said you're an absolute beginner in Code::blocks, but are you an absolute beginner in programming in general, or just in Code::blocks?
And how did you install wx?By ./configure --prefix=/opt/local, make, make install.
QuoteI normally use "wx-config" to find those.
I am pretty convinced I do not know how to use this advice:
...
How do I use the result?
I have been using CodeWarrior C/C++ for true cross-platform applications on Mac and WinPC for about 15 years.
I have been programming in the unix environment since I got my first Mac OSX, mainly continuing making source code. However, I am unexperienced in the programming environment setup such as writing Makefiles and understanding a proper gcc command line. I have gone as far as doing ./configure and make on opensource projects found on the net. I have also copied Makefiles from small projects and modified them to work with my own source code, not really understanding everything I've been doing.
I was hoping to port my cross-platform work from MWCW to someting more modern since the MWCW support stopped at OS X SDK 10.3.9.
It looked like Code::Blocks would help me avoiding commandline compiling, at least for a while, and still extend my cross-platform work to unix. I have some tru64 systems at my work that I would like to port some software to. But is teems I might have been too optimistic.
Do you suggest I get myself a WinPC and start learing Code::Blocks there, to get a feeling for the "normal" programming enviroment first?
By ./configure --prefix=/opt/local, make, make install.I'm not an expert at building wx, but if i'm not mistaken you're building a shared library... Hope you know what it means? I built static. Might be why it worked for me and not for you?
Do I need a global variable or a compiler flag to define the meaning of "wx"?Haven't read everything so i could be wrong, but i believe the global variable was the path to 'wx-config'. If you don't install 'wx-config' into /usr folders, or if some program can't find it, you can define a global variable pointing to it.
(Well i don't know how Code::Blocks behaves on 10.4 -- maybe it's more usable than on 10.3) However, if you need cross-platform, of course it won't work. Either use Code::Blocks, but knowing it may not work properly. For instance, on my compuer, Code::blocks isn't able to run projects or to debug.
I guess it is solved.
In "Compiler and debugger settings/Global compiler/Programs/Additional Paths" i added "/opt/local/bin".
Then the wx project built without errors.
Thank you all for your attention to help me thru.
You could have also solved it by adding /opt/local/bin to the "path" variable in your user .profile
QuoteYou could have also solved it by adding /opt/local/bin to the "path" variable in your user .profile
A bit strange, since 'wx-config' is readily available in my normal Terminal window.
Should CB import the normal user-defined path? It seems to me it does not do this.