[MS VS .NET] Compiling the lib - One single .lib or not?

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.
Post Reply
cr_itm
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

[MS VS .NET] Compiling the lib - One single .lib or not?

Post by cr_itm » Sat May 07, 2005 9:12 am

Hello,

I'm new to wxWidgets and have just downloaded the source. I compiled the lib with Visual Studio .NET the way it was described on a webpage (was it wxWiki?) -> I builded the workspace in the folder "wxWidgets-2.6.0/build/msw/wx.dsw". After compiling it, there were a lot of single .lib files in the "wxWidgets-2.6.0/lib/vc_lib" directory.

Now I tried to setup a new project with these instructions:
http://wiki.wxwidgets.org/wiki.pl?MSVC_.NET_Setup_Guide

When I try to compile my app, the linker says, there is no "wxmsw.lib" file. It not that I set up wrong path to the includes or libs, the file "wxmsw.lib" is just not there.

If I use "wxWindows.dsw" in the "src" folder and build the lib, than the file "wxmsw.lib" is there.

May someone explain the difference between building the lib(s) with the "wxWidgets-2.6.0/build/msw/wx.dsw" and the "wxWindows.dsw" in the "src" folder and above all, which one I should use? :)


Thanks in advance for you help

leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Re: [MS VS .NET] Compiling the lib - One single .lib or not?

Post by leio » Sat May 07, 2005 10:39 am

cr_itm wrote:If I use "wxWindows.dsw" in the "src" folder and build the lib, than the file "wxmsw.lib" is there.

May someone explain the difference between building the lib(s) with the "wxWidgets-2.6.0/build/msw/wx.dsw" and the "wxWindows.dsw" in the "src" folder and above all, which one I should use? :)
Definately don't use the one in the "src" folder. I have no idea why it was kept around, but all say it's broken, old, and shouldn't be used. The preferred way of doing the libraries is the multiple library way. But unfortunately some projects don't use that, and expect a monolithic library. Some of them might also work only with wxWidgets-2.4.2 unfortunately. These are the projects that don't get attention from its developers.
In the "batch build" (so named in VC6, perhaps diff name in .NET) can't you tick a monolithic build of wxMSW, unicode or non-unicode?
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/

cr_itm
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

Re: [MS VS .NET] Compiling the lib - One single .lib or not?

Post by cr_itm » Sat May 07, 2005 11:35 pm

leio wrote:The preferred way of doing the libraries is the multiple library way. But unfortunately some projects don't use that, and expect a monolithic library.
Thanks for your help. Now I don't use the "src"-files anymore to build the lib. But if you say, that the preferred way of building the libraries is to build several single lib's - why does my project ask for a single wxmsw.lib file? Furthermore, when I try to build any of the sample-projects, they always need one single lib file.
leio wrote:In the "batch build" (so named in VC6, perhaps diff name in .NET) can't you tick a monolithic build of wxMSW, unicode or non-unicode?
There are these sorts of builds I can choose from (when I understood it right):

Debug
Release
DLL Debug
DLL Release
Universal Debug
Universal Release

Non of them give me a single lib file, they all create several lib files.


I must admit, I don't understand the whole architecture of wxWidgets. I mean, after I compile the libs, why aren't they in the lib folder (they are in the "lib/vc_lib/" folder)? How can I create one single lib - or more important, how can I get the samples work with those several small lib files?

(I also had problems creating my own project without the single big lib file, but thats another issue, I first want to understand this thing with the libs...)


Thanks a lot for your help - you see, I'm a little bit confused here :)

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Re: [MS VS .NET] Compiling the lib - One single .lib or not?

Post by eco » Sun May 08, 2005 1:57 am

cr_itm wrote:I must admit, I don't understand the whole architecture of wxWidgets. I mean, after I compile the libs, why aren't they in the lib folder (they are in the "lib/vc_lib/" folder)? How can I create one single lib - or more important, how can I get the samples work with those several small lib files?

(I also had problems creating my own project without the single big lib file, but thats another issue, I first want to understand this thing with the libs...)
The reason for the individual subfolders in lib is because wxWidgets can be built a number of different ways so placing them in separate folders prevents different builds for conflicting with one another.

The samples should all just work. Open up their workspace and do a Build Solution.

If I remember correctly, wxmsw.lib is from the 2.4.x series. 2.5.x+ (including 2.6.0) all break the library up into several smaller libraries (then you can pick and choose what you want to link to more easily).

Here is what a Debug build of one of my application links to for wxWidgets 2.6.0:
wxmsw26d_adv.lib wxmsw26d_html.lib wxmsw26d_core.lib wxmsw26d_qa.lib wxbase26d.lib wxbase26d_xml.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib
You may not need all of those libraries. For a release build, link to the same except removing the trailing "d" in each of the libraries.

The best way I've found to setup wxWidgets with your own projects is to create an environment variable called something like WXDIR which contains the path to wxWidgets (e.g. "C:\wxWidgets-2.6.0"). Then, in your MSVC Tools | Options window, add to Projects > VC++ Directories in the Library files section "$(WXDIR)\lib\vc_lib" and "$(WXDIR)\include" to Include Files section. Then, in your project settings in the C/C++ > General section add "$(WXDIR)\lib\vc_lib\mswd" to your Additional Include Directories field for debug builds and "$(WXDIR)\lib\vc_lib\msw"; for release builds (this is to specify where the setup.h for the particular library you are linking to is at). Then, when upgrading or switching to a new version of wxWidgets, you only have to change that environment variable and everything just works and for someone else to use your project, all they have to do is add a WXDIR environment variable which makes this method very useful for multiuser projects. Also, it minimizes the setup needed to start a new project since all you need to do now is add those extra include directores and the library names.

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Sun May 08, 2005 6:57 am

I had to figure this out a while ago and this is what I do:

Include dirs;
$(WXWIN)/include/
$(WXWIN)/lib/vc_lib/mswd (and without the d for release, altough both setup.h files are similar)

Additional linker directories:
$(WXWIN)/lib/vc_lib/

Linker libs:
wxmsw26d_adv.lib wxmsw26d_html.lib wxmsw26d_core.lib wxmsw26d_qa.lib wxbase26d.lib wxbase26d_xml.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib

Preprocessor macros:
__WXMSW__ WXDEBUG=1 __WXDEBUG__ (latter for debug only)

I have recently developed a new CMake script (FindWxWin.cmake) and had to check out how it was done by bakefile. These flags are all you need.

Ofcourse match your threading model to MultiThreaded Debug DLL and MultiThreaded DLL to avoid linker errors.

For UNICODE, add a u to the lib like
wxmsw26d_advu.lib
wxmsw26d_advud.lib (with debug)


wxUniversal is also possible, but I don't know if it works, the last I heard they said it was broken ..

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

Avi
Super wx Problem Solver
Super wx Problem Solver
Posts: 398
Joined: Mon Aug 30, 2004 9:27 pm
Location: Tel-Aviv, Israel

Post by Avi » Sun May 08, 2005 10:05 am

Well, I already opened a post about monolithic builds a while ago, so you might wanna check it out for more information regarding the issue...

cr_itm
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

Post by cr_itm » Mon May 09, 2005 9:35 pm

Thanks a lot for all your help, now all runs smoothly :)

I followed your idea and created a inv. variable named WXPATH, it's a good way to setup VS.

However, I have some questions left:

- I read that I must use the preprocessor statements "WINVER=0x0400;wxUSE_GUI=1" - are these relics from older versions of wx? Because without them all runs well.

- I don't quite understand, why I must use "MultiThreaded Debug DLL", especially the "DLL", where is the DLL? :-)

- With what kind of lib does someone usually work? The debug version or the release version of the libs? I mean, do I need the debug version to debug my code when I don't want to debug wxWidgets itself?


Well, thanks again for your great help.

Avi
Super wx Problem Solver
Super wx Problem Solver
Posts: 398
Joined: Mon Aug 30, 2004 9:27 pm
Location: Tel-Aviv, Israel

Post by Avi » Mon May 09, 2005 10:53 pm

cr_itm wrote:- I read that I must use the preprocessor statements "WINVER=0x0400;wxUSE_GUI=1" - are these relics from older versions of wx? Because without them all runs well.

- I don't quite understand, why I must use "MultiThreaded Debug DLL", especially the "DLL", where is the DLL? :-)
I've been wondering about these too! Could someone comment? :)
cr_itm wrote:- With what kind of lib does someone usually work? The debug version or the release version of the libs? I mean, do I need the debug version to debug my code when I don't want to debug wxWidgets itself?
Well, sometimes wxWidgets itself has problems too. I personally link my debug-app-build to wx-debug-build and my release-app-build to a wx-release-build... It allows me to fully debug my code, as I can see what the wxWidgets classes receive from it... :)

Post Reply