1

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.

Thomas Smyth
  • 3,978
  • 5
  • 23
  • 33

2 Answers2

0

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

Cătălin Pitiș
  • 13,805
  • 2
  • 38
  • 62
  • I tried c.lib, then I get an error -> c.dll not found even though it is in the same folder as c.lib – user2256532 Aug 19 '13 at 08:31
  • You should check that c.dll is in a path that is configured for executable files (unfortunately I don't have visual studio to give you details). However, this path is different from the input library paths. – Cătălin Pitiș Aug 19 '13 at 10:23
0

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" )
Pierre Fourgeaud
  • 14,042
  • 1
  • 36
  • 59