User forums > Help

include header

(1/2) > >>

mikethebike:
Hi
 I cant find where to include the headers like:
#include <GL/glut.h>
I have the GL headers in H:/Program/src/include/GL
is that a problem with the above code? If so where do i need to put them to keep that code. And where
can I tell codeblocks other includes? is that meant to be below linker? where exactly?
Thanks
Michael

MortenMacFly:

--- Quote from: mikethebike on July 06, 2006, 06:55:56 pm ---#include <GL/glut.h>
I have the GL headers in H:/Program/src/include/GL

--- End quote ---
Assuming you have already created a project:
- right-click on the project in the Management panel, select "Build options"
- on the "Directories" tab, select the "Compiler" tab
- Click on "add" and add the path "H:/Program/src/include"
Notice the missing "GL" because you include "GL/glut.h" in your source file. Including headers is for the compiler, including the OpenGL library works similar. But you have to select the "Linker" tab and add the path to the libraries (I assume this is "H:/Program/src/lib" with your configuration). Of course you'll need to add the glut (or whatever OpenGL lib you're using) to the libraries: "Build Options" -> tab "Linker", click "Add", provide e.g. "glut32".

With regards, Morten.

mikethebike:
Thanks but:

Linking console executable: /win/FlyLegacy2Versuch/source/Release/FlyLegacy
Release/src/Main/CursorManager.o: In function `CCursorManager::Draw()':
CursorManager.cpp:(.text+0x1e4): undefined reference to `glMatrixMode'
CursorManager.cpp:(.text+0x1e9): undefined reference to `glPushMatrix'
CursorManager.cpp:(.text+0x1ee): undefined reference to `glLoadIdentity'
CursorManager.cpp:(.text+0x226): undefined reference to `gluOrtho2D'
CursorManager.cpp:(.text+0x230): undefined reference to `glMatrixMode'
CursorManager.cpp:(.text+0x235): undefined reference to `glPushMatrix'
CursorManager.cpp:(.text+0x23a): undefined reference to `glLoadIdentity'
CursorManager.cpp:(.text+0x25e): undefined reference to `glTranslatef'
CursorManager.cpp:(.text+0x268): undefined reference to `glPushAttrib'
.....

I did:
- Build options - Directories - Compiler
/usr/include
- Build options - Directories - Linker
/usr/lib64

but there's no include in the source files. What do i need to include in the srcfiles? And
where to put like glut32 as you mentioned? If i put glut32 int Build options - Linker
i get: /usr/lib64/gcc/x86_64-suse-linux/4.1.0/../../../../x86_64-suse-linux/bin/ld: cannot find -lglut32

Many thanks
Michael


mikethebike:
Done at least the gl stuff. but now about the same with plib:

Main.cpp:(.text+0x1233): undefined reference to `ssgInit()'

ssg is in plib. what libs do i need to include?
Thanks
Michael

MortenMacFly:
May I give you an advise: Before we step through each of the libs you are using (besides all these errors are NOT C::B related anyway), try to compile a hello world application on the command line.

If this works you'll know what folder to include and what libs to link against in which order. Then setting up C::B is absolutely easy. But if you don't know the dependencies of your project (and we can't tell you because we don't know your project) you'll always fail - no matter what IDE you're using.

With regards, Morten.

Navigation

[0] Message Index

[#] Next page

Go to full version