2011-07-06 181 views
0

我將g ++編譯的測試客戶端與我用Visual Studio 2008編譯的dll鏈接。它會生成以下錯誤消息。g ++未定義的錯誤引用

client2.o:client2.c:(.text+0x11): undefined reference to `ICD_Create(char*)@4' 
client2.o:client2.c:(.text+0x3e): undefined reference to `ICD_Remove()@0' 
client2.o:client2.c:(.text+0x88): undefined reference to `ICD_Open(unsigned int, unsigned int, char, unsigned int, unsigned int)@20' 
client2.o:client2.c:(.text+0xae): undefined reference to `ICD_Close()@0' 
client2.o:client2.c:(.text+0xf7): undefined reference to `ICD_Command(char const*)@4' 
client2.o:client2.c:(.text+0x11d): undefined reference to `ICD_Synchronize()@0' 
collect2: ld returned 1 exit status 

g ++和visual studio庫之間是否存在衝突?我使用錯誤的DLL接口?

更新:

g ++命令爲g ++ -o client2.out client2.0 I-cut_driver.dll

+0

你能包含導致這個錯誤的GCC命令嗎? – Foon

+0

這是C,C++還是兩者兼而有之?也許你在你的聲明中缺少'extern「C」'? –

+0

我在函數聲明中使用WINAPI(我相信這是一個用於__stdcall的宏)。這是Visual Studio DLL使用的約定嗎? – Peretz

回答

0

一般而言,C++具有不同C++編譯器產生的代碼不是鏈路兼容。用g++和VisualStudio構建的C++代碼幾乎肯定不是。

+0

@Banthar,@Employed:謝謝你的提示。所以,我對所有這些DLL配置感到困惑。我看到有COM DLL,.NET DLL,標準DLL,MFC DLL,特定的C++實現。我知道.NET和COM可以一起工作,標準可以從其他幾個工具中調用。但是,是否有一條經驗法則或一般方案來知道什麼可以與什麼聯繫? – Peretz