# Interface to kdb+ with c++

**URL:** https://forum.kx.com/t/interface-to-kdb-with-c/6070
**Category:** Community Support
**Tags:** kdb-and-q
**Created:** [May 12, 2009, 3:28pm UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070 "2009-05-12T15:28:00Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jespr](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@Jespr](https://forum.kx.com/u/Jespr)
#### Post date: [May 12, 2009, 3:28pm UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/1 "2009-05-12T15:28:00Z")

</div>

Received: by 10.100.106.12 with SMTP id e12mr763349anc.28.1242138488967; Tue,  
12 May 2009 07:28:08 -0700 (PDT)  
Date: Tue, 12 May 2009 07:28:08 -0700 (PDT)  
X-IP: 77.243.35.35  
User-Agent: G2/1.0  
X-Google-Token: iIgNPgwAAABZ6N3RkbfcH-0RSaGl2GGD  
X-HTTP-Via: 1.1 ISA-HQ-02  
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR  
2.0.50727),gzip(gfe),gzip(gfe)  
Message-ID:   
Subject: Interface to kdb+ with c++  
From: Jespr   
To: “Kdb+ Personal Developers”   
X-Google-Approved: [charlie@kx.com](mailto:charlie@kx.com) via web at 2009-05-12 14:33:14  
  
I have tried to interface kdb+ with c++, but i’m not getting any  
where. I am using Visual studio 2005 this i my code:  
  
#include “k.h”  
  
int main()  
{  
  
int c=khp(“localhost”,5001);  
  
return 0;  
}  
  
I have included q.lib in the linker settings. The program compiles  
with no errors, but when I start the program I get an error “The  
application failed to initalize properly (0xc0000005). Click on OK to  
terminate the application.”  
  
I got q.lib from [http://kx.com/q/w32/q.lib](http://kx.com/q/w32/q.lib)  
  
What am I doing wrong?

---

<div class="post-metadata">

### Author: ![felix1](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@felix1](https://forum.kx.com/u/felix1)
#### Post date: [May 12, 2009, 3:59pm UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/2 "2009-05-12T15:59:00Z")

</div>

X-Mailer: Apple Mail (2.930.3)

you need to include c.o in your build from [http://kx.com.w32/c.o](http://kx.com.w32/c.o)

---

<div class="post-metadata">

### Author: ![Jespr](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@Jespr](https://forum.kx.com/u/Jespr)
#### Post date: [May 13, 2009, 7:21am UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/3 "2009-05-13T07:21:00Z")

</div>

Thank you very much that was very helpful.I included [http://kx.com/q/w32/c.lib](http://kx.com/q/w32/c.lib) and download [http://kx.com/q/w32/c.dllto](http://kx.com/q/w32/c.dllto) my c++ project directory and it works now.On 12 Maj, 16:59, Felix Lungu \<felix.lu…\> wrote:\> you need to include c.o in your build fromhttp://kx.com.w32/c.o\>\> On 12 May 2009, at 17:28, Jespr wrote:\>\>\>\>\>\> \> I have tried to interface kdb+ with c++, but i’m not getting any\> \> where. I am using Visual studio 2005 this i my code:\>\> \> #include “k.h”\>\> \> int main()\> \> {\>\> \> int c=khp(“localhost”,5001);\>\> \> return 0;\> \> }\>\> \> I have included q.lib in the linker settings. The program compiles\> \> with no errors, but when I start the program I get an error “The\> \> application failed to initalize properly (0xc0000005). Click on OK to\> \> terminate the application.”\>\> \> I got q.lib fromhttp://kx.com/q/w32/q.lib\>\> \> What am I doing wrong?- Skjul tekst i anf?rselstegn -\>\> - Vis tekst i anf?rselstegn -\</felix.lu…\>

---

<div class="post-metadata">

### Author: ![felix1](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@felix1](https://forum.kx.com/u/felix1)
#### Post date: [May 13, 2009, 10:39am UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/4 "2009-05-13T10:39:00Z")

</div>

X-Mailer: Apple Mail (2.930.3)i would recommend to use c.o rather than c.dll. it is very small and it reduces the external dll dependancy or conflicts.On 13 May 2009, at 09:21, Jespr wrote:\>\> Thank you very much that was very helpful.\> I included [http://kx.com/q/w32/c.lib](http://kx.com/q/w32/c.lib) and download [http://kx.com/q/w32/c.dll\](http://kx.com/q/w32/c.dll%5C)\> to my c++ project directory and it works now.\>\> On 12 Maj, 16:59, Felix Lungu \<felix.lu…\> wrote:\>\> you need to include c.o in your build fromhttp://kx.com.w32/c.o\>\>\>\> On 12 May 2009, at 17:28, Jespr wrote:\>\>\>\>\>\>\>\>\>\>\>\>\> I have tried to interface kdb+ with c++, but i’m not getting any\>\>\> where. I am using Visual studio 2005 this i my code:\>\>\>\>\> #include “k.h”\>\>\>\>\> int main()\>\>\> {\>\>\>\>\> int c=khp(“localhost”,5001);\>\>\>\>\> return 0;\>\>\> }\>\>\>\>\> I have included q.lib in the linker settings. The program compiles\>\>\> with no errors, but when I start the program I get an error “The\>\>\> application failed to initalize properly (0xc0000005). Click on OK \>\>\> to\>\>\> terminate the application.”\>\>\>\>\> I got q.lib fromhttp://kx.com/q/w32/q.lib\>\>\>\>\> What am I doing wrong?- Skjul tekst i anf?rselstegn -\>\>\>\> - Vis tekst i anf?rselstegn -\> \>\</felix.lu…\>

---

<div class="post-metadata">

### Author: ![Jespr](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@Jespr](https://forum.kx.com/u/Jespr)
#### Post date: [May 13, 2009, 11:15am UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/5 "2009-05-13T11:15:00Z")

</div>

ok that sounds reasonable, I will use the c.o instead. Thanky you forthe advice.On 13 Maj, 11:39, Felix Lungu \<felix.lu…\> wrote:\> i would recommend to use c.o rather than c.dll. it is very small and ?\> it reduces the external dll dependancy or conflicts.\>\> On 13 May 2009, at 09:21, Jespr wrote:\>\>\>\>\>\> \> Thank you very much that was very helpful.\> \> I includedhttp://kx.com/q/w32/c.liband downloadhttp://kx.com/q/w32/c.dll\> \> to my c++ project directory and it works now.\>\> \> On 12 Maj, 16:59, Felix Lungu \<felix.lu…\> wrote:\> \>\> you need to include c.o in your build fromhttp://kx.com.w32/c.o\>\> \>\> On 12 May 2009, at 17:28, Jespr wrote:\>\> \>\>\> I have tried to interface kdb+ with c++, but i’m not getting any\> \>\>\> where. I am using Visual studio 2005 this i my code:\>\> \>\>\> #include “k.h”\>\> \>\>\> int main()\> \>\>\> {\>\> \>\>\> int c=khp(“localhost”,5001);\>\> \>\>\> return 0;\> \>\>\> }\>\> \>\>\> I have included q.lib in the linker settings. The program compiles\> \>\>\> with no errors, but when I start the program I get an error “The\> \>\>\> application failed to initalize properly (0xc0000005). Click on OK ?\> \>\>\> to\> \>\>\> terminate the application.”\>\> \>\>\> I got q.lib fromhttp://kx.com/q/w32/q.lib\>\> \>\>\> What am I doing wrong?- Skjul tekst i anf?rselstegn -\>\> \>\> - Vis tekst i anf?rselstegn – Skjul tekst i anf?rselstegn -\>\> - Vis tekst i anf?rselstegn -\</felix.lu…\>\</felix.lu…\>

---

<div class="post-metadata">

### Author: ![felix1](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@felix1](https://forum.kx.com/u/felix1)
#### Post date: [May 13, 2009, 4:13pm UTC](https://forum.kx.com/t/interface-to-kdb-with-c/6070/6 "2009-05-13T16:13:00Z")

</div>

X-Mailer: Apple Mail (2.930.3)sorry, on windows it is c.obj not c.o.On 13 May 2009, at 13:15, Jespr wrote:\>\> ok that sounds reasonable, I will use the c.o instead. Thanky you for\> the advice.\>\> On 13 Maj, 11:39, Felix Lungu \<felix.lu…\> wrote:\>\> i would recommend to use c.o rather than c.dll. it is very small and\>\> it reduces the external dll dependancy or conflicts.\>\>\>\> On 13 May 2009, at 09:21, Jespr wrote:\>\>\>\>\>\>\>\>\>\>\>\>\> Thank you very much that was very helpful.\>\>\> I includedhttp://kx.com/q/w32/c.liband downloadhttp://kx.com/q/w32/c.dll\>\>\> to my c++ project directory and it works now.\>\>\>\>\> On 12 Maj, 16:59, Felix Lungu \<felix.lu…\> wrote:\>\>\>\> you need to include c.o in your build fromhttp://kx.com.w32/c.o\>\>\>\>\>\> On 12 May 2009, at 17:28, Jespr wrote:\>\>\>\>\>\>\> I have tried to interface kdb+ with c++, but i’m not getting any\>\>\>\>\> where. I am using Visual studio 2005 this i my code:\>\>\>\>\>\>\> #include “k.h”\>\>\>\>\>\>\> int main()\>\>\>\>\> {\>\>\>\>\>\>\> int c=khp(“localhost”,5001);\>\>\>\>\>\>\> return 0;\>\>\>\>\> }\>\>\>\>\>\>\> I have included q.lib in the linker settings. The program compiles\>\>\>\>\> with no errors, but when I start the program I get an error “The\>\>\>\>\> application failed to initalize properly (0xc0000005). Click on OK\>\>\>\>\> to\>\>\>\>\> terminate the application.”\>\>\>\>\>\>\> I got q.lib fromhttp://kx.com/q/w32/q.lib\>\>\>\>\>\>\> What am I doing wrong?- Skjul tekst i anf?rselstegn -\>\>\>\>\>\> - Vis tekst i anf?rselstegn – Skjul tekst i anf?rselstegn -\>\>\>\> - Vis tekst i anf?rselstegn -\> \>\</felix.lu…\>\</felix.lu…\>
