[問題] 使用3rd lib遇到link error
sorry 我 po 完文就試出來了
加上
#ifdef _DEBUG
#pragma comment(lib, "SoundTouchD.lib")
#else
#pragma comment(lib, "SoundTouch.lib")
#endif
成功
這是論壇查到的
不過還有個問題,因為我lib是用VC build出來的,
如果我使用此lib的程式想用gcc來build,
要怎麼解決name mangling的問題呢??(此lib是c++寫的,非c)
沒什麼用3rd lib的經驗...
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++ 2010 Express
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
SoundTouch
http://www.surina.net/soundtouch/
問題(Question):
無法link
http://www.codeguru.com/forum/archive/index.php/t-517257.html
我遇到的問題跟上面這個人遇到的類似
用2010 VC Express可以成功build出 .lib 檔,但link有問題
我還有用dumpbin去看.lib檔,
其中 455 public symbols 中確實有
19EC2 ??0SoundTouch@soundtouch@@QAE@XZ
19EC2 ??1SoundTouch@soundtouch@@UAE@XZ
而且我也有把 lib 所在目錄加進
project 的 Additional Library Directories
請問要怎麼追查 link 失敗的原因呢?
錯誤結果(Wrong Output):
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>test.obj : error LNK2019: unresolved external symbol "public: virtual
__thiscall soundtouch::SoundTouch::~SoundTouch(void)"
(??1SoundTouch@soundtouch@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "public: __thiscall
soundtouch::SoundTouch::SoundTouch(void)" (??0SoundTouch@soundtouch@@QAE@XZ)
referenced in function _main
1>C:\LetsKTV\SoundTouch_VC_Test\test\Debug\test.exe : fatal error LNK1120: 2
unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
程式碼(Code):(請善用置底文網頁, 記得排版)
#include "SoundTouch.h"
#include <iostream>
using namespace soundtouch;
using namespace std;
int main()
{
SoundTouch m_SoundTouch;
cout << "test" << endl;
return 0;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.135.140.149
※ 編輯: Arton0306 來自: 220.135.140.149 (02/19 11:11)
※ 編輯: Arton0306 來自: 220.135.140.149 (02/19 11:13)
※ 編輯: Arton0306 來自: 220.135.140.149 (02/19 11:16)
※ 編輯: Arton0306 來自: 220.135.140.149 (02/19 13:17)
推
02/19 13:22, , 1F
02/19 13:22, 1F
→
02/19 13:22, , 2F
02/19 13:22, 2F
→
02/19 13:27, , 3F
02/19 13:27, 3F
→
02/20 19:39, , 4F
02/20 19:39, 4F
→
02/20 19:40, , 5F
02/20 19:40, 5F
推
02/20 20:23, , 6F
02/20 20:23, 6F
→
02/20 20:24, , 7F
02/20 20:24, 7F
→
02/20 20:24, , 8F
02/20 20:24, 8F