views:

615

answers:

2

Hopefully someone can help me out here. I'm using Visual Studio 2005 and creating a static library that links in wxWidgets statically. I have:

  1. compiled wxWidgets statically according to their guide
  2. included the lib directory in my "Additional Library Directories" property
  3. added all of the wxWidget libs in my "Additional Dependencies" property
  4. set my "Link Library Dependencies" property to "Yes"
  5. set C++ Optimization to Disabled.

I know that some of those steps shouldn't have to be done, I did so on a "just in case" rational.

While my library compiles without a hitch, the test application that includes my static lib complains during linking that it cannot find 'wxbase28.lib' (which I included).

I should note that I abstracted wxWidgets out completely, so the library's public API has no mention of anything wxWidget-related. The test app shouldn't know that wxWidgets exists.

My tiny library has grown to over 51 MB, so I get the feeling that the libraries are being linked in... so why does my test application complain that it cannot find the wxWidgets library?

Thank you

A: 

I hate to suggest the obvious, but is wxbase28.lib listed in the list of dependencies of your test application?

Jim Buck
Unfortunately, it won't be that easy to diagnose...wxbase28.lib isn't referenced in the properties anywhere, or any file in the entire folder tree of the project (save the build log complaining about not finding it).No worries about suggesting anything obvious; I'm more comfortable in linux so I miss some subtleties in Visual Studio
Marc
+1  A: 

It is the link step in the build process that pulls dependent libs in : When you build a static library, it does NOT pull in any recursive dependencies as there is no link step.

So both - your - and wx's - static libs need to be present then for the final application to link.

Chris Becke
Forgive me if I'm not following you properly. Are you saying that I cannot statically link in a static library and have that be an internal part of my library? That would seem to be the antithesis of static linking.If that is the case, then is there some permutation of static/dynamic linking steps that will get my desired effect of an application only linking in my library and having wxwidgets doing some of the work in the background?
Marc
If you made your library a dynamic library, THEN there would be a linking step, and the dependent static libs would be included.But yes, you cannot statically link in a static library and have it be a part of your lib.I lie actually. From the command line you can usually use the `lib` tool to extract and insert object files into static libs. The lib tool might have options to directly combine two libs... otherwise just export all the object files from one, and import into the other. (this may fall afoul of wx's licencing)
Chris Becke
I'm getting the same results when I link in wxwidgets statically and compile as a DLL =(. My test application still complains about the missing wxbase28.lib.I'm also still a little confused as to how there's no linking step for static, and yet my build ballooned to over 50 megs (from about 1 MB) when I included wxwidgets. So if the libs aren't being linked in, what's taking up all of that space?
Marc
Not sure what fixed my problem with the DLL, but after some random magic, it works. Thank you
Marc