Author Topic: using a static librairie projetc in a console C++ project  (Read 7379 times)

Offline zerimbak

  • Single posting newcomer
  • *
  • Posts: 2
using a static librairie projetc in a console C++ project
« on: February 13, 2013, 05:35:24 pm »
Hi all,

I'am using Code::blocks version 12.11 with OS windows XP 32 bits
I created a C static librairie with a single function : void test()

I made a C program which use le librairie (libtest.a) ,  the programme works very well.

And after that, I made a C++ program (the same with the same librairie - I linked it correctly )
but this program is not working, the compilation made an error : undefined reference to test()

Thanks for your help

Offline jarod42

  • Multiple posting newcomer
  • *
  • Posts: 87
Re: using a static librairie projetc in a console C++ project
« Reply #1 on: February 13, 2013, 06:39:08 pm »
unrelated to C::B

You may use extern "C" in your library header when linking with c++



Offline zerimbak

  • Single posting newcomer
  • *
  • Posts: 2
Re: using a static librairie projetc in a console C++ project
« Reply #2 on: February 13, 2013, 07:37:57 pm »
 Very good !! It's working !!
Thanks a lot.  :)