Problem description:
When compiling a coding project under vs2008 with vs2010 today, vs provides a bunch of Link error messages, as shown in:
34 Link error messages are listed in errorlist, but many of them are repeated. Only two or three external symbols are incorrectly parsed, as shown below:
"Public: static void _ cdecl STD: _ string_base: _ xran (void )"(? _ Xran @ _ string_base @ STD @ saxxz)
"Public: static void _ cdecl STD: _ string_base: _ xlen (void )"(? _ Xran @ _ string_base @ STD @ saxxz)
Problem Analysis:
First, you can confirm thatProgramIn the build process, link the static Link Library libprotobuf. the external symbols cannot be parsed during Lib, and we can see that libprotobuf. many intermediate target files in the Lib Library (in windows. objects suffixed with obj.
What are the two symbols "_ xran" and "_ xlen"? Can Google get a general idea of the two symbols in the string class at that time? Is the problem with referencing the string class? Then we can follow the steps below to observe what the source file that references the string header file is after ide preprocessing.
1. Create a file named test. cpp with simple content. It only contains a string header file, that is, # include <string>
2. Open command prompt in Vs and enter the command Cl/EP test. cpp> D: \ 1.txt.
AboveCommandTo pre-process test.cppusing the msvccompiler, and redirect the content to 1.txt.
Scenario 1:
If you use the command line tool under vs2005 vs2008, you can find the following content after you open 1.txt:
Case 2:
If you are using vs2010, search for _ xlen and _ xran in the corresponding 1.txt file, the content is as follows:
Supplement: The second _ xran and _ xlen are defined in class basic_string, which is obviously different from those generated in vs2005 and vs2008.
Summary:
The static Link Library libprotobuf. Lib is compiled on the earlier ide version. Therefore, the symbols in the string class are parsed to form static void _ cdecl _ xlen ()
In vs2010, The _ xlen and _ xran characters in string are parsed into _ declspec (noreturn) void _ xlen () Const.
So a bunch of problems with the above beginning will occur during the link process.
Solution:
Method 1:
Re-compile libprotobuf. Lib in a later version of IDE. This method is the most effective and very simple.
Method 2:
You can create a new link library, export several symbols that cannot be parsed, and redirect these symbols to the pre-processed symbols in vs2010. Specific reference this URL: jn123 in the http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/5ac28a31-3339-4db1-90f4-68edad360309 to give the method
Welcome to load, please note the Source: http://www.cnblogs.com/royenhome