| failbit (7) | |||||
|
Hello, I recently got Ubuntu and I do not know how to link libraries or add search paths for headers. I use G++ (which is what I used on WIndows, but the commands do not seem to work) I am trying to use SFML and Boost. SFML is in home/failbit/Libraries/SFML-1.6 and includes lib (library files) and include (header files) I tried compiling with:
I get errors because g++ cannot find the headers or the libs. this is my test program:
| |||||
|
Last edited on
|
|||||
| Athar (3764) | |
|
You forgot a / in front of home. But there's no need to use a custom install anyway (unless you want to modify the SFML library). Just install the package libsfml-dev and then you won't need to specify any additional paths. | |
|
|
|
| failbit (7) | |
|
Thanks it worked :D BUt now I need opengl can I install it with: sudo apt-get install libopengl | |
|
Last edited on
|
|
| Athar (3764) | |
|
If you install freeglut3-dev, you'll get the whole thing: Mesa GL & GLU and GLUT. If you need GLEW, that would be libglew1.5-dev. | |
|
|
|
| failbit (7) | |
| It works! Thanks for your help Athar. | |
|
|
|
| failbit (7) | |
|
I have one more question. It is possible to use -L,-l, and -I in Linux just like in Windows? How would I direct g++ to the files if it is possible? Eg: I have SFML in home/failbit/Libraries/SFML-1.6/ Would I use: g++ main.cpp -L/home/failbit/Libraries/SFML-1.6/lib ? | |
|
Last edited on
|
|
| Athar (3764) | |
|
Yes, that's how it works. But as mentioned, you only need to do that for your own libraries. Libraries installed via the package manager go to /usr/lib, where the linker will look without being told to. | |
|
|
|
| bigearsbilly (143) | |||||
|
try this: create a file called Makefile in your program directory. Just put this in it: (first check I got it right of course)
your file is called main.cpp? so type: make main and something like this should happen:
simples... look for gnu make on your favourite search engine. Or you can export them as variables and not even need a makefile. | |||||
|
|
|||||