link error in Visual Studio 2010

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.
echemist
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Mar 29, 2012 1:59 pm

link error in Visual Studio 2010

Postby echemist » Thu Mar 29, 2012 2:36 pm

Hi all,

I just obtained wxWidgets this week, so I am a new user. I have a limited background in C programming, and no experience in C++, so I am still new to programming as well.

I have been trying to follow a basic example of using wxWidgets from this site:

http://zetcode.com/tutorials/wxwidgetst ... tprograms/

The example I am looking at is the first example, "A Simple Application."

I am using Visual Studio 2010, so I had to modify the compilation instructions. Thanks to this site:

http://wiki.wxwidgets.org/Microsoft_Vis ... B%2B_Guide

I was finally able to make progress following the instructions under "Creating a new project by hand."

I built the wxWidget library at the Visual Studio 2010 command line, using the Visual C++ makefile, because I wanted to build it as the monolithic library. I did this in the hopes of speeding up my first project - I figured I would not have to worry about which particular libraries I would have to link against from the multilib build to get my project to work. I built the monolithic library as a unicode debug static library, and the build succeeded.

When I went to build the project in Visual Studio 2010 (using the gui IDE), I modified the project properties to direct the linker to the folder and libraries that it needed, but I was getting fatal linker error LNK1104, e.g. cannot open file 'wxbase29ud.lib'. Just for grins, I specified that the linker should ignore that file, and the linker produced another error opening 'wxbase29ud_net.lib'. So I continued to add each library file to the list for the linker to ignore. Finally, the project compiled and linked successfully.

My question is this: why does it appear that the linker was looking for the individual libraries of a multilib build? I could not find any option under the linker heading that looks like it bears on this, though I suspect I am overlooking something important. The library that I did specify for it to link against is called 'wxmsw29ud.lib'; I figured this must be the monolithic library since it is 163MB!

Thanks for any help.

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

Re: link error in Visual Studio 2010

Postby doublemax » Thu Mar 29, 2012 4:21 pm

Using monolithic libs is very unusual under Windows and none of the samples use it, so i would suggest against it.

Also, tutorials and wiki pages get out of date pretty quickly, so here's my recommendation on how to proceed:

Get the latest source package from the wxWidgets site. Unless you have a specific reason to use 2.8.x, go for 3.0.1 (or whatever the latest version is) as it comes with more up-to-date project files for Visual Studio.

Make sure you get the source package with DOS line endings, VS doesn't under stand Unix line endings.

After unpacking, navigate to <wxdir>/build/msw/ and open "wx_vc10.sln".

You usually need to build only two different configuratons:
"debug" and "release" for static linking of wxWidgets (my recommendation)
or
"DLL debug" and "DLL release" to build wxWidgets into DLLs.

These should build out of the box. When building the "DLL" versions, you might have to build several times, as some libaries depend on others, but the build order is incorrect.

If the libraries build correctly, navigate to <wxdir>/samples/minimal/ and open "minimal_vc9.vcproj". Select the same configuration that you used for the library and build.

If that was successful, copy the minimal sample and start your own project from there.
Last edited by doublemax on Wed Aug 06, 2014 8:58 am, edited 1 time in total.
Use the source, Luke!

echemist
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Mar 29, 2012 1:59 pm

Re: link error in Visual Studio 2010

Postby echemist » Thu Mar 29, 2012 4:45 pm

Hi doublemax,

Thanks for your reply. I was able to quickly get the "minimal" example working with your excellent instructions.

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Re: link error in Visual Studio 2010

Postby Auria » Fri Mar 30, 2012 1:30 am

doublemax wrote:Using monolithic libs is very unusual under Windows and none of the samples use it, so i would suggest against it.

Also, tutorials and wiki pages get out of date pretty quickly, so here's my recommendation on how to proceed:

Get the latest source package from the wxWidgets site. Unless you have a specific reason to use 2.8.x, go for 2.9.3 (or whatever the latest version is) as it comes with more up-to-date project files for Visual Studio.

Make sure you get the source package with DOS line endings, VS doesn't under stand Unix line endings.

After unpacking, navigate to <wxdir>/build/msw/ and open "wx_vc9.sln".

You usually need to build only two different configuratons:
"debug" and "release" for static linking of wxWidgets (my recommendation)
or
"DLL debug" and "DLL release" to build wxWidgets into DLLs.

These should build out of the box. When building the "DLL" versions, you might have to build several times, as some libaries depend on others, but the build order is incorrect.

If the libraries build correctly, navigate to <wxdir>/samples/minimal/ and open "minimal_vc9.sln". Select the same configuration that you used for the library and build.

If that was successful, copy the minimal sample and start your own project from there.


now that you took the time to write it all, why don't you add this to the wiki then, to make it less outdated? ;P
"Keyboard not detected. Press F1 to continue"
-- Windows

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

Re: link error in Visual Studio 2010

Postby doublemax » Fri Mar 30, 2012 10:35 am

now that you took the time to write it all, why don't you add this to the wiki then, to make it less outdated? ;P
Because then i would have to keep it up-to-date :)

Also, for a wiki entry, it should be more generalized and more elaborate which i'm too lazy to do.
Use the source, Luke!


Return to “Compiler / Linking / IDE Related”

Who is online

Users browsing this forum: No registered users and 9 guests