我有两个基于C++的lib文件,一个是公司提供的,另一个是我自己使用公司提供的源代码编译的。我正在使用 Windows 7 x64 并使用 makefile 编译库。
当我尝试使用我编译的库链接程序时,它会产生一个错误(LNK 2019:未解析的外部符号),抱怨它在库中找不到函数。
我发现的问题是链接器要查找的函数名有一个@-suffix,但是我编译的库没有那个后缀。如果我使用公司提供的库,它有@-suffix 并且工作正常。所以我想知道这个@-suffix 是什么意思,以及如何编译库以使其具有该后缀。
感谢您的阅读,任何帮助将不胜感激。
附言。下面是 dumpbin 输出的初始部分,上面的部分来自公司的库,下面的部分是我编译的:
公司图书馆
Microsoft (R) COFF/PE Dumper Version 12.00.30723.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file motor.lib
File Type: LIBRARY
Archive member name at 8: /
5602DBD6 time/date Wed Sep 23 18:05:26 2015
uid
gid
0 mode
29F93 size
correct header end
5179 public symbols
51FA4 _S826_WriteReg@12
51FA4 __imp__S826_WriteReg@12
52010 _S826_WriteBridge@24
52010 __imp__S826_WriteBridge@24
5207E _S826_WatchdogWaitCancel@4
5207E __imp__S826_WatchdogWaitCancel@4
我编译的库
Microsoft (R) COFF/PE Dumper Version 12.00.30723.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file motor.lib
File Type: LIBRARY
Archive member name at 8: /
56796705 time/date Tue Dec 22 15:06:45 2015
uid
gid
0 mode
2A45B size
correct header end
5252 public symbols
52368 S826_WriteReg
52368 __imp_S826_WriteReg
523D0 S826_WriteBridge
523D0 __imp_S826_WriteBridge
5243A S826_WatchdogWaitCancel
5243A __imp_S826_WatchdogWaitCancel