Advertisement

Odd static library problem...

Started by June 09, 2000 04:11 PM
3 comments, last by null_pointer 24 years, 6 months ago
I decided to create a static lib for my exception class, just out of fun (so don''t argue with me, ok?). It''s just a simple Win32 static library with 1 .cpp file and 1 .hpp file. The .hpp file declares my exception class using __declspec(dllexport) so that it is exported, and the .cpp file contains mostly empty function definitions. The exception class itself contains one pure virtual function, output(). Now, the static library builds properly and all is good until I go to use it in my map editor. I added the .lib file to my project, copied the header and changed the dllexport to dllimport. I also included the .hpp file in the two files which use it. Here are the linker errors from my map editor executable:
    Linking... Creating library Debug/Map Editor.lib and object Debug/Map Editor.exp LINK : warning LNK4049: locally defined symbol ""public: __thiscall debug::exception::exception(void)" (??0exception@debug@@QAE@XZ)" imported LINK : warning LNK4049: locally defined symbol ""public: virtual __thiscall debug::exception::~exception(void)" (??1exception@debug@@UAE@XZ)" imported LINK : warning LNK4049: locally defined symbol ""protected: static unsigned int debug::exception::instances" (?instances@exception@debug@@1IA)" imported LINK : warning LNK4049: locally defined symbol ""public: __thiscall debug::exception::exception(class exception::exception const &)" (??0exception@debug@@QAE@ABV01@@Z)" imported
I have absolutely no idea why things are being exported from the map editor! BTW, warnings are from VC 6.0 SP2. I should have no trouble with this! Thanks for your time! - null_pointer Sabre Multimedia
This may be stupid on my part, but did you include in your header files something along the lines of:

#ifndef HEADER_H
#define HEADER_H
//Put header info here
#endif
Advertisement
Unless I''m missing something big, why would you use dllexport at all? This is a static library, not a dll.

Rock
Yeah, a static library is really just a bunch of object files combined.. So all you have to do is declare stuff as local (not imported) and link in the library, and it should work like it''s part of the code from the program you''re using it with.
Doh!

I haven''t been online for a while now, so thanks for your help!


- null_pointer
Sabre Multimedia

This topic is closed to new replies.

Advertisement