wxWidget with codeblocks problem

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.
gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

wxWidget with codeblocks problem

Post by gtafan » Wed Apr 05, 2017 1:45 pm

Have instaled CodeBlocks and wxWidget 3.0.2 but still unable to start a wxWidget project, always geting this error mesages:

Image

Image

I don´t care about debug, as never using it, but release is a problem.
My OS is Windows, but it should be already clear because of the pics.

For building wxWidgets I have used the comandline from the wiki:
mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1 clean
mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1
So after that some .a files apear in the lib folder, but the error mesage staied the same, as befor building.

The lib folder looks like that:

Image

and the gcc_lib:

Image

Posibly some .a files are mising?

Have used wxDev befor and had no problems, exept wxDev is outdated.

User avatar
doublemax
Moderator
Moderator
Posts: 15074
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidget with codeblocks problem

Post by doublemax » Wed Apr 05, 2017 2:05 pm

Use the source, Luke!

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2514
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWidget with codeblocks problem

Post by PB » Wed Apr 05, 2017 2:25 pm

By the way gtafan, if you want to use C++11, you should build wxWidgets in C++11 mode, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1 CXXFLAGS="-std=gnu++11"

gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

Re: wxWidget with codeblocks problem

Post by gtafan » Wed Apr 05, 2017 2:44 pm

PB wrote:By the way gtafan, if you want to use C++11, you should build wxWidgets in C++11 mode, e.g.

Code: Select all

mingw32-make -f makefile.gcc BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1 CXXFLAGS="-std=gnu++11"
And what about that clean stuff? Also if I remember right my CodeBlocks version has integrated mingW 4.9, so shouldn´t it be something like CXXFLAGS="-std=gcc++11"? Also on CB forum I was tolld that some .a files are mising.

gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

Re: wxWidget with codeblocks problem

Post by gtafan » Wed Apr 05, 2017 2:47 pm

The comandline there looks more or less like mine, exept that "-fno-keep-inline-dllexport", what that´s good for?

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 352
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxWidget with codeblocks problem

Post by New Pagodi » Wed Apr 05, 2017 2:52 pm

Before diving into wxWidgets, you might want to make sure you have your compiler set up with codeblocks by making and running a console application.

1)From the menu, select "File->New->Project...".
2)In the resulting popup, select "Console application". Then hit the "Go" button. This will start a wizard.
3)On the first 2 pages, just hit next. On the third page, enter a name for the project. On the 4th page, make sure you have "GNU GCC Compiler" selected. Then hit the finish button.
console.png
console.png (31.75 KiB) Viewed 2923 times
4)From the menu, select "Build->Build and run".

If that runs without problem, then codeblocks is set up with your compiler. If not, you need to take some extra steps to do that.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 352
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxWidget with codeblocks problem

Post by New Pagodi » Wed Apr 05, 2017 3:01 pm

Before building a wxWidgets application in codeblocks, you should set a wx global variable in codeblocks.

1) From the menu, select "Settings->Global variables..."
2) In the resulting popup, hit new. That will start a second popup.
3) In that second popup, enter "wx" and hit OK.
4) Back in the first popup, select the base field, and enter the root location of your wxWidgets files. (The folder that contains build, include, lib, etc).
wxglobal.png
wxglobal.png (13.36 KiB) Viewed 2916 times
5) Then hit close.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2514
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxWidget with codeblocks problem

Post by PB » Wed Apr 05, 2017 3:06 pm

gtafan wrote: And what about that clean stuff? Also if I remember right my CodeBlocks version has integrated mingW 4.9, so shouldn´t it be something like CXXFLAGS="-std=gcc++11"?
I assume that everyone knows that one should clean the previous build remnants so it does not need to be said.

I would also recommend using newer compiler, such as MinGW 5.3 but perhaps 4.9 is good enough for C++11.

Older wxWidgets and MinGW have problems when compiling in standard C+11 mode due to bugs in MinGW. The issue has been resolved for now, at least for wxWIdgets GIT head but who knows when it breaks again. Either way, wxWIdgets documentation clearly states that -std=gnu++11 should be used instead of std=c++11 (which I assumed you meant by std=gcc++11).
See e.g. here for recent discussion regarding the topic: https://groups.google.com/d/msg/wx-user ... YKLYkbAgAJ
Last edited by PB on Wed Apr 05, 2017 3:07 pm, edited 1 time in total.

stahta01
Super wx Problem Solver
Super wx Problem Solver
Posts: 367
Joined: Fri Nov 03, 2006 2:00 pm

Re: wxWidget with codeblocks problem

Post by stahta01 » Wed Apr 05, 2017 3:06 pm

FYI: There is no reason to think the OP actually built wxWidgets successfully; I tried help him/her on the Code::Blocks forum and they will NOT post any information needed to confirm the wxWidgets was built!

Tim S.

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 352
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxWidget with codeblocks problem

Post by New Pagodi » Wed Apr 05, 2017 3:16 pm

If those first 2 steps are completed, you're now ready to try to build a wxWidgets application.


1)From the menu, select "File->New->Project...".
2)In the resulting popup, select "wxWidgets project". Then hit the "Go" button. Again, this will start a wizard.
3)
  • On the first page, just hit next.
  • On the second page, pick your wxWidgets version.
  • On the third page, enter a project title
  • Enter whatever you want on the forth page.
  • Pick a GUI builder and application type on the 5th page. For now, you probably want to use "wxSmith" for the builder and "Frame based" for the application type. Later, you might want to try wxFormbuilder.
  • On the 6th page, enter "$(#wx)" for wxWidgets location. This is important.
  • On the 7th page, as with the console application, make sure "GNU GCC Compiler" is selected. If you haven't build a debug version of the library, uncheck "Create Debug configuration".
  • The 8th page is the most important one. You need to make sure the settings you enter here match the version of the wxWidgets library you have built. Given the settings you mentioned above, you should enter these settings on this page:
    finalsettings.png
    finalsettings.png (34.74 KiB) Viewed 2911 times
  • Hit the finish button.
4)You should be able to build and run the project.

gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

Re: wxWidget with codeblocks problem

Post by gtafan » Wed Apr 05, 2017 3:23 pm

New Pagodi wrote:Before diving into wxWidgets, you might want to make sure you have your compiler set up with codeblocks by making and running a console application.

1)From the menu, select "File->New->Project...".
2)In the resulting popup, select "Console application". Then hit the "Go" button. This will start a wizard.
3)On the first 2 pages, just hit next. On the third page, enter a name for the project. On the 4th page, make sure you have "GNU GCC Compiler" selected. Then hit the finish button.
console.png
4)From the menu, select "Build->Build and run".

If that runs without problem, then codeblocks is set up with your compiler. If not, you need to take some extra steps to do that.
The "Console application" was the first I tried and it worcked. I have the latest version of CB with buildin compiler. I think it´s mingW 4.9, but not 100% shure about that.

gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

Re: wxWidget with codeblocks problem

Post by gtafan » Wed Apr 05, 2017 3:36 pm

New Pagodi wrote:Before building a wxWidgets application in codeblocks, you should set a wx global variable in codeblocks.

1) From the menu, select "Settings->Global variables..."
2) In the resulting popup, hit new. That will start a second popup.
3) In that second popup, enter "wx" and hit OK.
4) Back in the first popup, select the base field, and enter the root location of your wxWidgets files. (The folder that contains build, include, lib, etc).
wxglobal.png
5) Then hit close.
Why do I have to use global variables? Why not just select the right path in the CB wizard? Why can I do it the way I have done here?:

Image

New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 352
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxWidget with codeblocks problem

Post by New Pagodi » Wed Apr 05, 2017 4:17 pm

If you use the global wx variable, when you update the wxWidgets library, you only have to update the global variable and all projects will continue to work with the new wxWidgets version.

If you use the specific location in the wizard, if you update the wxWidgets library, you'll have to update many settings in every single project.

User avatar
doublemax
Moderator
Moderator
Posts: 15074
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxWidget with codeblocks problem

Post by doublemax » Wed Apr 05, 2017 5:30 pm

@New Pagodi

As we get so many posts with C:B and MinGW related problems, could you make one post that summarizes it all? Then we could make it sticky so that hopefully more people find it.
Use the source, Luke!

gtafan
I live to help wx-kind
I live to help wx-kind
Posts: 172
Joined: Wed Mar 29, 2017 9:52 am

Re: wxWidget with codeblocks problem

Post by gtafan » Thu Apr 06, 2017 2:45 pm

New Pagodi wrote:If you use the global wx variable, when you update the wxWidgets library, you only have to update the global variable and all projects will continue to work with the new wxWidgets version.

If you use the specific location in the wizard, if you update the wxWidgets library, you'll have to update many settings in every single project.
I know about problems with updating the wxWidgets library, but I don´t care about that, as I am not going to update wxWidgets library next time. At the moment it´s my only goal to build a wxWidget GUI that is compatible with my C++11 code.
Till now I have worcked only with IDEs having some kind of plugin system, so I naever had to build some libraries on comandline, but this fact not making me troll, like Tim think.

Post Reply