2012-09-19 44 views
4

我升級我的項目從VS 6 VS 2010,同時建立在發佈模式,我對着下面的錯誤錯誤LNK2019:在函數引用解析外部符號__imp__debugf「詮釋__cdecl fld_new

1>Creating library .\Release\JfFrpF32.lib and object .\Release\JfFrpF32.exp> 
1>FLD_.obj : error LNK2019: unresolved external symbol __imp__debugf referenced in function "int __cdecl fld_new(char *,unsigned char,unsigned char,short,char,char,unsigned char,short,char,double,double,short,char *,char,short,short)" ([email protected]@[email protected]) 
1>Release/JfFrpF32.dll : fatal error LNK1120: 1 unresolved externals 
1> 
1>Build FAILED. 

請幫助我..在此先感謝..

+0

你可以從FLD_.cpp粘貼fld_new –

回答

5

常見的問題,導致LNK2019包括:

  • 符號的聲明包含一個拼寫錯誤,使得 它與符號的定義不同。

  • 使用了一個函數,但參數的類型或數量不是 與函數定義相匹配。

  • 調用約定(__cdecl,__stdcall或__fastcall)在 上使用函數聲明和函數定義有所不同。

  • 符號定義在編譯爲C程序的文件中,並且符號在沒有外部「C」修飾符的C++文件中聲明。在 的情況下,修改聲明。

更多信息See Here

1

在我的情況下,即使我用extern "C",我得到了解決的符號錯誤。
的HPP是

extern "C" 
{ 
class A 
{ 
public: 
    void hi(); 
}; 
A* a; 
DECLDIR int Connect(); 
}//extern 

和CPP是

#include "DatabasePlugin.hpp"// Include our header, must come after #define DLL_EXPORT 


extern "C" // Get rid of name mangling 
{ 
    DECLDIR int Connect() 
    { 
     a = new A(); 
     a->hi(); 
     return 0; 
    }//Connect 
}//extern 

的問題是,我沒有創建了hi()功能的實現。添加它解決了這個問題。就像這樣:

extern "C" // Get rid of name mangling 
{ 
    void A::hi() {} 

    DECLDIR int Connect() 
    { 
     a = new A(); 
     a->hi(); 
     return 0; 
    }//Connect 
}//extern 

Hi()之前Connect()聲明也可能是顯著。

相關問題