User forums > Using Code::Blocks
CodeBlocks and compiling wxWidgets Projects
weisswurst:
Hi!
Well, short introduction of myself...
At my job I develop since 4 years MFC and WinApi with MS Visual C++ 6.
Last week I decieded to try Linux again. I'm currently running Ubuntu Feisty...
And now I want to programm a little bit using CodeBlocks and wxWidgets in Ubuntu.
So I'm new to Linux, new to CodeBlocks and new to wxWidgets.
Here's the problem.
I got so far, that I've sucessfully installed a 2 or 4 days old CodeBlocks Nightly, wxWidgets 2.8 and gtk+ 2.something which I can't remember.
If I create a wxWidget project using the assistand in CodeBlocks I can compile that.
But I can't create an empty wxWidget project, generate a .cpp and .h file like in that wxTutorial and compile that. The compiler is complaining that he can't find the wx.h oder wxprec.h :(
So I think it's a mistake in my CB configuration.
Can you help me?
Thanks a lot!
Pecan:
It makes sense that the wiki example doesn't work on Linux.
That article was written long before Biplab wrote us such an excellent wizard to do most of the drudge setup work.
Linux needs the `wx-config --cflags` provided by the wizard in the compile defines. This directive tells the compiler where to find your wxWidgets headers.
In the linker, there's another directive `wx-config --libs` that tells the linker where the wxWidgets libraries are.
At a console prompt, type in those directives and you'll see how much information they provided to the compiler and linker. If it wasn't for the Wizard and those directives, you'd have to provide all that info youself.
To see how they work on the command line turn on full compile logging.
//-- Full Compile Logging --
"Settings" -> "Compiler and Debugger"
"Global Compiler Setting"
"Other Settings"
"compiler logging:" set to "Full Command Line"
Windows does not need these. Use the wizard. That's what it's there for.
Cut and paste the wiki examples into the wizard code if you want.
weisswurst:
Ok that helps a little :)
But it leads me to an other question.
Why do I see no dialog after compiling and running that wiki code?
I just created a wx project with default settings and replaced the BC default oninit()
with the following one
--- Code: ---bool wxTest7App::OnInit()
{
wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World"));
frame->CreateStatusBar();
frame->SetStatusText(_T("Hello World"));
frame->Show(TRUE);
SetTopWindow(frame);
return true;
}
--- End code ---
I tried to debug but I can put breakpoints to anywhere. The program starts end ends, with no stop between. :(
Pecan:
Be sure that your compiler options contains the -g flag.
Please see:
//-- Debugging
Debugging with CodeBlocks
and
http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/
http://www.sci.brooklyn.cuny.edu/~goetz/codeblocks/codeblocks-instructions.pdf
raph:
--- Quote from: weisswurst on February 11, 2007, 11:36:42 pm ---I tried to debug but I can put breakpoints to anywhere. The program starts end ends, with no stop between. :(
--- End quote ---
Remember, in order to debug your program, you have to choose "Debug"->"Start". "Build"->"Run" will not make you program stop at breakpoints.
Your code seems ok.
Navigation
[0] Message Index
[#] Next page
Go to full version