LNK2019 error: unresolved external symbol __imp__debugf specified in the function "int __cdecl fld_new

I am updating my project from VS 6 to VS 2010, and when creating in release mode, I encounter the error below.

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)" ( ?fld_new@ @ YAHPADEEFDDEFDNNF0DFF@Z ) 1>Release/JfFrpF32.dll : fatal error LNK1120: 1 unresolved externals 1> 1>Build FAILED. 

Please help me .. thanks in advance ..

+4
source share
2 answers

Common problems causing LNK2019 include:

  • A character declaration contains a misspelling error, so this is not the same name as the character definition.

  • A function was used, but the type or number of parameters did not match the definition of the function.

  • The calling convention (__cdecl, __stdcall or __fastcall) differs in the use of a function declaration and function definition.

  • Character definitions are contained in a file that was compiled as a C program and characters are declared in a C ++ file without the "C" extern modifier. In this case, change the announcement.

For more information, see here.

+5
source

In my case, although I used extern "C" , I got an unresolved character error.
Hpp was

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

and cpp was

 #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 

The problem was that I did not create an implementation for the hi() function. Adding it solved the problem. Like this:

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

Having a hi() declaration before Connect() can also be significant.

+1
source

Source: https://habr.com/ru/post/1435042/


All Articles