Search code examples
c++kdb

error LNK2019: unresolved external symbol khpu referenced in function "private: void __cdecl


I added c.obj from https://github.com/KxSystems/kdb/tree/master/w64 - #pragma comment(lib, "c.obj")

But I am getting this error

\3rdParty\kdb\c.obj : warning LNK4003: invalid library format; library ignored

5>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

error LNK2019: unresolved external symbol k referenced in function "public: virtual void __cdecl...

error LNK2019: unresolved external symbol ktd referenced in function "private: void __cdecl ...

error LNK2019: unresolved external symbol khpu referenced in function "private: void __cdecl ...

fatal error LNK1120: 3 unresolved externals

I have tried everything there in google but nothing seems to work.


Solution

  • In the Microsoft documentation it is said that :

    #pragma comment( lib, "commenstring" )
    

    lib

    Places a library-search record in the object file. This comment type must be accompanied by a commentstring parameter containing the name (and possibly the path) of the library that you want the linker to search.

    It searches for a library not an object file.

    You should have a .lib file to include with this pragma directive.

    It should be something like :

    #pragma comment( lib, "c.lib" )