convert dynamic library to static
I have an exsisting solution in Visual Studio 2005 which contains three projects.
lets say them A,B,C.
Two of them are confugured (A,B) to build as static libraries, and the third (C) is confugured to build as dynamic library and it links with the previous two.
I changed the Configuration Type of the third project (C) to static library and specified the previous two (A,B) as its dependents. And it builds fine generating C.lib.
But when I am using the C.lib library in application it gives me linking error.Note that when my library is built as dll everything works fine and I can use the library from my projects and I am not getting any linking errors.
What's the problem? Where am i wrong?
what should i do to generate .lib file that i can use in my projects?
thank u all
when i try to use the library as static i get the following linking error, if i use the library compiled as dynamic everything works ok.
error LNK2019: unresolved external symbol __imp__SuperAssertionW referenced in function _main .
the library i am using is BugslayerUtil by John Robinson.
and when i get it the project was configured to compile as dll.
and when i get it the project was configured to compile as dll.
Well, the Error-Message says, that it doesn't find the Functionsymbol in the Library.
This problem mostly occurs, when the Preprocessor-Defintions do not match.
This often causes your code to compile because the Declaration is valid in the header, but the symbol is not compiled into the .lib.
If the BugHunter-Util is delivered as DLL you should use it as DLL or consult the Docs on how to change it to a static lib (and if its even allowed by the license).
regards
This problem mostly occurs, when the Preprocessor-Defintions do not match.
This often causes your code to compile because the Declaration is valid in the header, but the symbol is not compiled into the .lib.
If the BugHunter-Util is delivered as DLL you should use it as DLL or consult the Docs on how to change it to a static lib (and if its even allowed by the license).
regards
is it possible somehow to change something in the source code of the library and get it to work as static library?
and if it is possible what should i change?
and if it is possible what should i change?
Quote:Original post by elih1Yes, almost certainly.
is it possible somehow to change something in the source code of the library and get it to work as static library?
In this case you should look for (and remove) __declspec(dllexport/dllimport) declarations prefixing the library's exported symbols (e.g. functions, data or classes.)
Note that these will probably be hidden away in a macro somewhere rather than being written out explicitly each time.
According to this Thread http://codeguru.earthweb.net/forum/showthread.php?t=432360 you need to #define SUPERASSERTIONS. Did you define this?
regards
regards
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement