I am attempting to build a console application that depends on 4 other libraries using Visual Studio 2008. I was able to build the application in a previous version of Visual Studio.
3 of the libraries are in C code and the other is in C++.
I have checked (more than once) that all the libraries and my application are all compiled using the multi-threaded DLL (/MD). My command line compile options for each library and my application are as follows:
I get 25 LNK2005 errors regarding basic_string already being defined in my application. I suspect it has something to do with lib4 because when I take it out of the project the LNK2005 errors go away and I get unresolved external errors for the functions I use out of that library (although I'm not sure what order those errors are generated in).
I have tried ignoring msvcprt.lib but I get unresolved externals for other functions.
I have turned on verbose to see what libraries are being included and they are as follows:
msvcprt.lib (where the errors are given)
Wow - you've already done a lot more investigation than most people who ask questions here
What can I suggest....
1. I notice that some of your libs use "/Od" and others don't and others use "/Ox". This will affect how methods of template classes (like std::basic_string) are inlined in your libraries - it's possible (I think) that a std::basic_string method may be embedded in an object file and then re-exported from a library?
2. I'd be tempted to use dumpbin (it comes with VS) or objdump (comes with GCC, if you have that installed) to dump various properties of the lib files (use dumpbin /all library-name) and then search through the resultant text for names of basic_string methods that look like they're defined rather than referenced?
3. Or maybe delete lib4, then add object files back into lib4 one by one, to see when the LNK2005 occurs?
So - no concrete answers, just possibilities
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
Suggestion 1 didn't work, but it is probably better to have them all the same anyway, considering what affect that option has.
I used dumpbin on the offending library. It looks to me like it is defined but I would just like to check.
In the exports table the functions (e.g. resize) that the linker complains about are external and prefixed with __imp_. Is this why the linker is complaining?
Basically, one of the files in lib4 creates its own class which inherits from std::string. For older versions of C++, it has the lines
#define std_string string
in the header file.
For newer versions of Visual C++, it simply has
#define std_string std::string
What is the difference between these two?
As far as I can see, the header file calls the functions in inline functions without the specifier std::
Other than that those functions aren't overridden or referred to anywhere else.
I have a fix for a edit box
I have a edit box (dialog box) which take string input ..........
The input at edit has a long limit i want to have finite entries in the edit box say string with 5 chars or number with 5 digits where i set the scope of the input string