Newbe Getting codeBlocks and WXWidgets working..Help!

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.
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

Hi thanks in advance for any help :)

I have been trying for a day or two to get Code Blocks working with WX Widgets. I will not include the reams of message i have had just yet and just ask the question. Is it possible to use wx Widgets with Code Blocks on windows 10. The versions i am using are the newest ones that are on both websites. i.e
Code Blocks 16.01 with the TDM-GCC : codeblocks-16.01mingw-setup.exe this one. And i am using WX Widgets 3.0.2. I have managed to compile as far as i know wx widgets without errors, but it seems quite complex, have i compiled it with the right settings - i don't have my example now as i'm at work-
I copy the setup.h and that seems to work. But nothing complies it cant find -lwxmsw28ud.

Before i spend any more time on this can somebody confirm it is possible cheers :)

When i get home i can be more specific on a few things.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

it cant find -lwxmsw28ud.
This indicates that the project you're trying to build uses wxWidgets 2.8.x. But you have 3.0.2 instead.

When you create a new wxWidgets projects in CB, it asks you which wxWidgets version to use. Select 3.0.x.
Use the source, Luke!
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

OK tried that -am at work still so not much info- other than now it cant find -lwxmsw30ud. I feel i might be getting something wrong, do these versions of CB and WX widgets that i have defiantly work together or do i need a older version of gcc? do i need to use 4.8.1?
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

I haven't tested that particular CB / GCC version combination, but i'm pretty sure it works. Especially since you're only having linker problems.

How did you build the wxWidgets libraries?
Die you start with new CB project? Did you get any error messages when creating it?
Use the source, Luke!
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

I will wait till i get home in an couple of hours then i can give the exact code i used to compile wx widgets, their was quite a lot to it. Thanks for the help, be back soon.
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

Right i'm back. I was trying things at work but didn't have time to compile wxwidgets so i used the pre compiled version. That is what i was using in the last message. I am now using the uncomplied version of wxwidgets.

Code Blocks 16.01 with the TDM-GCC : codeblocks-16.01mingw-setup.exe this one. And i am using WX Widgets 3.0.2.
I have set a global variable for C:\Program Files (x86)\CodeBlocks\MinGW

I have just done a fresh install of wxwidgets and compiled it with this at the command line.

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 UNICODE=1 SHARED=0 USE_OPENGL=1 CXXFLAGS="-std=gnu++11 -fno-keep-inline-dllexport"
At first i was getting a c++11 error using a method on one of the wikis, then came across this. I added MONOLITHIC as from what i had read this seemed needed. I am a complete beginner at his and am learning as i go along. It seems to compile ok without errors.

I have copied the setup.h file, i don't get any errors on this, i did at first.

When i create a project, i select wxwidgets 3, point it at the wxwidgets folder, i have selected use DLL, build as monolithic and unicode and also precompiled headers. I get an error straight away about matching Release configuration.

I have the c++ flag set in the complier setting. When i compile it all i get is this

Code: Select all

||=== Build: release in rfew (compiler: GNU GCC Compiler) ===|
ld.exe||cannot find -lwxmsw30u|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 4 second(s)) ===|
In the compiler settings i have set a flag to c++1, auto detected the compiler -works fine for console- and under Search Directory/Complier i have added C:\wxWidgets-3.0.2. not really sure about that last one it was a bit of a guess.

A bit stuck. Thanks in advance for your help :)
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

I have copied the setup.h file
That shouldn't be necessary. During the build of the libraries, it should be copied to the correct place automatically. Copying it manually may shadow the real problem(s).
i have selected use DLL
That's in contradiction to "SHARED=0" from the command line above.
Use the source, Luke!
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

You don't need to copy setup.h? I am on Windows, before i copy it it always says it cant find it. I read the sticky at the top of this part of the forum and it is the first thing they say you should do? Has this changed?

I am new to compiling from the command line so that explains the issue with the pre complied headers, but i have also tried it without this selected when creating a project and it didn't seem to make any difference.

I'm guessing your lack of clues mean either i am far of the mask or missing something obvious.

Well at least i know it's possible and i'm not using the wrong versions so i will keep trying. No pain no gain i guess.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

You don't need to copy setup.h? I am on Windows, before i copy it it always says it cant find it.
That means that the include directories are not set correctly.
I read the sticky at the top of this part of the forum and it is the first thing they say you should do?
Where exactly?
Has this changed?
I don't know any platform / compiler combo where this is necessary.
I'm guessing your lack of clues mean either i am far of the mask or missing something obvious.
Yes, this should be a matter of at most half an hour.

If you ignore CB for a moment and just try to build the "minimal" sample from the command line, does that work? If yes, it's "only" a matter of CB configuration.

Alternatively, try CodeLite, many users prefer it over CodeBlocks.
Use the source, Luke!
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

viewtopic.php?f=19&t=255

This is were the explanation about setup.h is. If this isn't correct then it should probably be moved from the top sticky.
What is the explanation for this? It does seem quite clear in what it says.

I haven't built anything from the command line other than wxwidgets it's self. I'm not sure attempting that would help would it? I cant find any examples of doing this after a quick google. Do you have a link to somewhere that would get me started on doing that?

Codelight could be an option, but i would rather persevere and understand whats going on as i need to understand it anyway regardless of the IDE.
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

I haven't built anything from the command line other than wxwidgets it's self. I'm not sure attempting that would help would it?
I think it would. If the wxWidgets libraries and the samples build fine from the command line, you know that on the wxWidgets and compiler side everything is fine. From there it's only a matter of configuring your IDE correctly.
Do you have a link to somewhere that would get me started on doing that?
After you built the libraries, just change dir to <wxdir>/sample/minimal/ and re-use the same command line. That should build the sample.
Use the source, Luke!
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by New Pagodi »

When you run through the new project wizard in codeblocks, its important to that the settings entered match a configuration of the library you've built. Otherwise codeblocks won't be able to find all the files it needs to build and link the project.

For 3.02 built with the line

Code: Select all

mingw32-make -f makefile.gcc BUILD=release MONOLITHIC=1 UNICODE=1 SHARED=0 USE_OPENGL=1 CXXFLAGS="-std=gnu++11 -fno-keep-inline-dllexport"
the settings should look like the following.

On the second page, make sure you select wxWidgets 3.0.x:
02.png
02.png (1.9 KiB) Viewed 10676 times
On the 7th page,
1) make sure GNU GCC Compiler is selected,
2) since you haven't build a debug configuration, make sure that is unselected, and
3) make sure release configuration is selected:
07.png
07.png (6.05 KiB) Viewed 10676 times
On the 8th page,
1) since you built with "SHARED=0", make sure use wxWidgets DLL is unselected,
2) since you built with "MONOLITHIC=1", select that
3) With the wxWidgets 3.0.x, you should always select Enable Unicode
08.png
08.png (3.15 KiB) Viewed 10676 times
trolleypark
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Feb 22, 2016 12:57 pm

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by trolleypark »

Hi New Pagodi, Thanks a lot for going out of your way to explain that, it' works! and i can now compile wxwidgets examples from the IDE. I have learnt a lot doing this and will now go through the whole process a few times so i fully understand all the compiler options and how to use them. Thanks you.

doublemax thanks as well for your advice and i will take your advice and learn to compile the examples from the command line, your right in that it will be a useful thing to do.
casali enea
In need of some credit
In need of some credit
Posts: 1
Joined: Thu Dec 29, 2016 9:20 am

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by casali enea »

I apologize for my poor english writing.

I m trying to getting codeblocks and wxwidgets working
I read a lot in this forum.

I m using windows 8.1 64bit
code block v13.12
I downloaded wxpack v2.8.8.04.exe and installed it.

I have created a new wxWidget project in code block and all functions,
I can build the project but when I run it
the process exit with status 255. I seem it can't find wxWidget.dll

Than I have tried to make the library two times: v.3.0.x
following the instruction found in a wiki
I can build the library, I configure code block to find the library
but when I try to build I encounter an error: no debug or release configuration!!!

many thanks for your help
enea
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Newbe Getting codeBlocks and WXWidgets working..Help!

Post by doublemax »

Than I have tried to make the library two times: v.3.0.x
following the instruction found in a wiki
Please post the exact command lines you used to build wxWidgets.
code block v13.12
The latest version is 16.01, please try that one.
Use the source, Luke!
Post Reply