Author Topic: linking static library in code::blocks  (Read 1667 times)

Offline matejuh

  • Newcomer
  • *
  • Posts: 2
linking static library in code::blocks
« on: April 24, 2010, 02:21:05 pm »
Hi, I'm writing a program using flow-tools library libft.a and I'm not able to link it in this IDE. When I compile it in terminal its OK.
Terminal: g++ -g -Wall -pedantic -o test testKompilace.cpp -lft -lz
OK
Code::Blocks with all possible options where to link it:

-------------- Build: Debug in IPTree ---------------

g++ -L/usr/lib/  -o bin/Debug/IPTree obj/Debug/iptree.o obj/Debug/iptreenode.o obj/Debug/main.o   -lft -lnsl -lz -pg  -lft -lz /usr/lib/libft.a
obj/Debug/main.o: In function `main':
/home/matej/Programming C++/IPTree/main.cpp:48: undefined reference to `ftio_init(ftio*, int, int)'
/home/matej/Programming C++/IPTree/main.cpp:50: undefined reference to `fterr_errx(int, char const*, ...)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings

Offline matejuh

  • Newcomer
  • *
  • Posts: 2
Re: linking static library in code::blocks
« Reply #1 on: April 24, 2010, 03:02:52 pm »
After two hours looking of problem its solved... I was linking the library right all the time, but ftlib is c library, so I needed use extern "C"... Stupid...