cancel
Showing results for 
Search instead for 
Did you mean: 

Re: [personal kdb+] Standalone KDB/C program without using c.dll ?

charlie
New Contributor II
New Contributor II
can you link with c.obj instead?
10 REPLIES 10

_Oz_
New Contributor
This is pretty cool, all this time and builds of qpad and I didn't realize that I can do that 🙂

Thanks a lot, Charlie, works like a charm!

Oleg

yzhao0527
New Contributor
Hi, Oleg,

are you using Visual studio to compile your code? if yes, could you let me know how to link to c.obj in visual studio?

Many thanks

_Oz_
New Contributor

Just include it in your project, same way you did with c.lib to use c.dll
Don't forget to remove c.lib or exclude it from build.

Cheers!

yzhao0527
New Contributor
This is exactly what I did, but VS fails with the following message:


1>------ Build started: Project: demo_kdb1, Configuration: Debug Win32 ------
1>Build started 1/24/2013 4:29:04 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\demo_kdb1.unsuccessfulbuild".
1>ClCompile:
1>  connect.cpp
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>c.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function _cls
1>c.obj : error LNK2019: unresolved external symbol __imp__ioctlsocket@12 referenced in function _snb
1>c.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _wsa
1>c.obj : error LNK2019: unresolved external symbol __imp__gethostbyaddr@12 referenced in function _hl
1>c.obj : error LNK2019: unresolved external symbol __imp__htonl@4 referenced in function _hl
1>c.obj : error LNK2019: unresolved external symbol __imp__ntohl@4 referenced in function _addr
1>c.obj : error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function _addr
1>c.obj : error LNK2019: unresolved external symbol __imp__inet_addr@4 referenced in function _addr
1>c.obj : error LNK2019: unresolved external symbol __imp__accept@12 referenced in function _accp
1>c.obj : error LNK2019: unresolved external symbol __imp__bind@12 referenced in function _cb
1>c.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function _cb
1>c.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function _cb
1>c.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function _cb
1>c.obj : error LNK2019: unresolved external symbol __imp__setsockopt@20 referenced in function _sopt
1>c.obj : error LNK2019: unresolved external symbol __imp__listen@8 referenced in function _lstn
1>c.obj : error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function _pod
1>c.obj : error LNK2019: unresolved external symbol __imp__getsockname@12 referenced in function _pod
1>c.obj : error LNK2019: unresolved external symbol __imp__getsockopt@20 referenced in function _apu
1>c.obj : error LNK2019: unresolved external symbol __imp__select@20 referenced in function _apu
1>c.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function _rcv
1>c.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function _snd

I included this file by right click project name, -> properties -> VC++ Directories -> modify the Library Directories
Then -> Linker -> input -> additional dependences -> add c.obj

Is this what I am supposed to do?

While you are at the libs dialog, add "ws_32.lib" as well.�

charlie
New Contributor II
New Contributor II

Thanks Charles, I figured out what's going wrong.

I am missing a library file ws2_32.lib. Passing this file to the linker solves the problem.

And thank you for your suggestion on the apps, but I am actually making a kdb add-in for Excel with additional functionality, some of them are from other scientific C++ libraries. I think it's better for me to build everything from scratch.

Best

charlie
New Contributor II
New Contributor II
btw, if you're creating an add-in for excel, please bear in mind this note


this might also apply to c.obj in addition to c.dll (as you will be building a dll for loading into excel, an xll).

thanks

Thanks for the reply, so I assume I would use cst.obj instead.

Best

yzhao0527
New Contributor
Thank you for the reply.

i have very minimum knowledge with Visual Studio 2010, do you know how to link a obj file in this IDE?