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

StackOverflow https://stackoverflow.com/questions/18309038

  •  25-06-2022
  •  | 
  •  

سؤال

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.

هل كانت مفيدة؟

المحلول

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" )

نصائح أخرى

#pragma comment lib doesn't accept object files, only libraries. I see that you have a c.lib file, and I assume that is the library file you need to include with pragma directive, so change it to #pragma comment( lib, "c.lib")

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top