User forums > Using Code::Blocks

how to properly set up a library?

<< < (2/6) > >>

blueeyedlion:
I'm using the gnu compiler,

and windows 7 if that makes a difference.

ouch:
Ok, it's strait forward then.

Just go to project->build options

Then click on linker settings tab, then click add. Just type the name of the library without the extension.

Then click the search directories tab, click linker sub tab, then click add, then click the 3 dot button, (this button means browse...) and select the directory where your library is.

Then click the compiler sub tab, click add, click the 3 dot button, then select the directory where your header is.

And thats it, click OK.

be sure to call the the header from your code and enjoy your library. :)

You should also add the header to your project too (project->add files...) this allows code blocks to search through it for the good stuff. But it's not required. But seriously do it, default plugins need it, and are quite awesome. For instance it will scan that header and when you go type a function it will pop up and allow you to select the function you were going to type. To top it off it will tell you the number of arguments that function takes and the argument type that the function is expecting and even the return type if any.

blueeyedlion:
Ok, I did that but now there's an error:

cannot find -lpdcurses

I'm trying to get pdcurses working by the way.

ouch:
then on the search directories tab->linker sub tab part you didn't select the directory where that library is found.

blueeyedlion:
After a bit of looking, I misnamed the library in the linker settings tab.  I did put in the path correctly.
Now I have a new error:

undefined reference to 'stdscr'

I'm using the simple "Hello World" sample code for pdcurses.

which way was closer to working?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version