How can I get rid of the __imp__ prefix in the linker in VC++?

后端 未结 5 1222
野性不改
野性不改 2020-12-01 06:29

I\'m using libcurl and am getting the following sort of linker errors in VC++ 10.

1>main.obj : error LNK2019: unresolved external symbol __imp__curl_easy_         


        
5条回答
  •  悲哀的现实
    2020-12-01 06:48

    You are using a header file that defines the function prototype with the specifier evaluating to __declspec(dllimport)

    You need to either redefine the statement that is evaluating to this (set it to nothing), or use a different header file altogether.

    Typically you'll see code like this:

    #ifdef FOO_EXPORTS
    #define DLLSPEC __declspec(dllexport)
    #else
    #define DLLSPEC __declspec(dllimport)
    #endif
    
    ...
    
    DLLSPEC bool foo(int bar);
    

    Compiling the project with FOO_EXPORTS defined will use one mode and without it will use the other.

提交回复
热议问题