User forums > General (but related to Code::Blocks)

Problem configuring C::B to do simple things

(1/1)

nmtservice:
Hi colleagues and gurus!!
I'm facing a very newbie problem because this is my first attempt to use a IDE, normally I fire things from the crude command line.
My setup is Xubuntu 6.10; gcc version 4.1.2 20060928 and C::B svn 3466

This is my C 101 svgalib program:

--- Code: ---
#include <stdio.h>
#include <stdlib.h>
#include <vga.h>

int main(void)
{

vga_init();
vga_setmode(5);
vga_setcolor(4);
vga_drawpixel(10,10);

sleep(5);
vga_setmode(0);


printf("Hello world!\n");
return 0;
}

--- End code ---

When i compile it from command line I type:

--- Code: ---raul@creta:~/pojectos/svtest$ gcc -O main.c -Lvga

--- End code ---
and a.out is created without problems and it works!

But when tried to run from C::B I get:

--- Code: ----------------- Build: Debug in svtest ---------------
Linking console executable: ./svtest
obj/Debug/main.o: In function `main':
/home/raul/pojectos/svtest/main.c:8: referencia a `vga_init' sin definir
/home/raul/pojectos/svtest/main.c:9: referencia a `vga_setmode' sin definir
/home/raul/pojectos/svtest/main.c:10: referencia a `vga_setcolor' sin definir
/home/raul/pojectos/svtest/main.c:11: referencia a `vga_drawpixel' sin definir
/home/raul/pojectos/svtest/main.c:14: referencia a `vga_setmode' sin definir
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
5 errors, 0 warnings
--- End code ---

Which in english means that no vga library was recognized or loaded

vga.h (and others svgalib development files ) are located in rigth places

--- Code: ---raul@creta:~$ whereis vga.h
vga: /etc/vga /usr/include/vga.h /usr/share/man/man4/vga.4.gz
--- End code ---

So, How can I tell C::B where go to load vga or another non trivial libraries/headers?

raph:
Hi

just go to "Project"->"Build Options"->"Linker"->"Link libraries" and "Add" your library "vga".

nmtservice:
Thanks!

Navigation

[0] Message Index

Go to full version