Does wx code auto-include .libs?

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.
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Does wx code auto-include .libs?

Post by JohnD »

In a new project I am getting a linker error "cannot open file 'wxbase28ud_net.lib'" but I haven't got this particular LIB in my project settings. Does wx automatically try to include libs through imports in the source?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

Also why do I need so many libs? I added this line:

Code: Select all

#include <wx/app.h>
And so far I'm up to 12 .libs I have had to add. If they're all essential, why not just one big lib? Or is this a sign I should have some preprocessor #define set up?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote:Also why do I need so many libs? I added this line:

Code: Select all

#include <wx/app.h>
And so far I'm up to 12 .libs I have had to add. If they're all essential, why not just one big lib? Or is this a sign I should have some preprocessor #define set up?
If you need few libs then build a monolithic build
http://wiki.wxwidgets.org/Microsoft_Vis ... B%2B_Guide
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

Well I am not doing ANY wx code yet, but every time I add one .lib and build, I get an error another one is missing - even the jpeg libs are being wanted but I have no idea why. Where are all the imports for those libs coming from?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote:Well I am not doing ANY wx code yet, but every time I add one .lib and build, I get an error another one is missing - even the jpeg libs are being wanted but I have no idea why. Where are all the imports for those libs coming from?
What is your platform? Which IDE do you use?
I would recommend CodeLite
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

Win7, VS2008. Used wx in several projects nicely, for some reason it's going a bit loopy.

Are there #defines I should be putting in any wx project to control it?
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote:Win7, VS2008. Used wx in several projects nicely, for some reason it's going a bit loopy.

Are there #defines I should be putting in any wx project to control it?
and how do you build your wxWidgets?
If you build non monolithic you will have to add a lot of library and some library must come before another, in order. I would advice to make a monolithic build or you will have to learn which library comes first.

I had such problem years ago when I was learning C::B and few months ago when I forgot --enable-monolithic
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

The link you posted doesn't talk about monolithic builds, I've never heard of this. Not run into problems before, I can't see what my current project does differently to an old one.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

from wxWiki (the same link above)
Building Single Configurations

Build all libraries you need one by one, in the following order:

wxjpeg,
wxpng,
wxtiff,
wxzlib,
wxregex,
wxexpat,
base,
net,
odbc,
core,
gl,
html,
xml,
media,
qa,
adv,
dbgrid,
xrc,
aui,
richtext

Check your file : "wxWidgets-X.Y.Z\INSTALL-MSW.txt"
I have never used VC++ and so I cannot be of great help. I will try to help anyway. Here are links that I guess might be helpful
http://wiki.codeblocks.org/index.php?ti ... olkit_2003

http://wiki.wxwidgets.org/Troubleshooti ... crosoft_VC

http://wiki.wxwidgets.org/Compiling_WxW ... _with_MSVC
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

I still can't figure out, how is building my app throwing "can't find wxXXX.lib"? If I don't include the .lib I should just get unresolved symbol errors, how does the compiler even know the library names I need? I searched the wx codebase for ".lib" and didn't find much, it must be in there somewhere.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote:I still can't figure out, how is building my app throwing "can't find wxXXX.lib"? If I don't include the .lib I should just get unresolved symbol errors, how does the compiler even know the library names I need? I searched the wx codebase for ".lib" and didn't find much, it must be in there somewhere.
It seems your build is non monolithic and there is a library that depends on another which is not included. Compile a monolithic build! Assuming VC++ compiler is in your enviroment path then use:
cd wx_dir/build/msw
nmake -f makefile.vc SHARED=1 MONOLITHIC=1 BUILD=release
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

I'll try although, what's the output of a monolithic build supposed to be?

I have now added all the .libs to my project and now it complains:

Code: Select all

Error	2	error LNK2019: unresolved external symbol "public: void __thiscall wxStringData::Free(void)" (?Free@wxStringData@@QAEXXZ) referenced in function "public: void __thiscall wxStringData::Unlock(void)" (?Unlock@wxStringData@@QAEXXZ)	MPL1.obj
But this seems wrong, this is in the core/base library. Something is fundamentally screwed up - monolithic build was not needed on any other project and they don't force me to have all the .libs.
Which is the correct file(s) to include in a .cpp, to use wx? Maybe I have that wrong or something.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote: Which is the correct file(s) to include in a .cpp, to use wx? Maybe I have that wrong or something.
How much competent are you with wxWidgets? Each widgets have its include file like

Code: Select all

#include <wx/string.h>
wx header have the basic stuff

Code: Select all

#include <wx/wx.h>
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
JohnD
Earned some good credits
Earned some good credits
Posts: 118
Joined: Fri Nov 21, 2008 2:18 pm

Post by JohnD »

I just want to test my app compiles with wx... I'm checking because in Windows API for instance if you naively include individual files it can screw up.

I just include <wx/wx.h> right now, and everything is totally broken. Every other wx project I've done, I just add a few core libs and it works.
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Post by evstevemd »

JohnD wrote:I just want to test my app compiles with wx... I'm checking because in Windows API for instance if you naively include individual files it can screw up.

I just include <wx/wx.h> right now, and everything is totally broken. Every other wx project I've done, I just add a few core libs and it works.
Try codes in tutorial below and see if it works
http://zetcode.com/tutorials/wxwidgetstutorial/
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Post Reply