C++ Question Getting static library to link with any compiler

Zatnikitelman

Addon Developer
Addon Developer
Joined
Jan 13, 2008
Messages
2,303
Reaction score
6
Points
38
Location
Atlanta, GA, USA, North America
I'm working on a utility static library (.lib) for stuff I'm doing in Orbiter, and I can get it to compile fine with other VC++2008 projects with lots of help from dbeachy1, but I can't get it to compile with a VC++2010 project. I was able to get rid of a C1047 Error, but now I'm being hit with an LNK2001 error:
Code:
error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ)
Everything I've found via Google tells me that the problem is the .lib was built in VS2008 while I'm trying to build in 2010. I know it's possible, otherwise how would I be able to compile against Orbiter's own static libraries?
Thanks for any help,
Matt
 
I know it's possible, otherwise how would I be able to compile against Orbiter's own static libraries?
That's probably because std::_String_base::_Xran(void) function isn't used by Orbiter's static libraries.
 
My best guess is that it's used by a 'string' class you use in your code of the static library. If there are no many different operations on strings, you could try replace them with C char[]s.
 
You could use various tricks depending on your project. Would need to see code to be more specific. In the end you can usually resort to doing a dynamic linkage. I have had success in compiling orbiter add-ons with MinGW.
 
@orb: I got rid of all references to std::string in my library code, but I still have the same error when using the library. It only occurs when I include the class in my library, if I comment out the class, but still #include the file, it compiles fine.

@Hielor: until I get things worked out, I've been doing doing rebuild instead of just build and of course it's still throwing the error.
 
Back
Top