Author Topic: include header  (Read 10978 times)

Offline mikethebike

  • Multiple posting newcomer
  • *
  • Posts: 24
    • Homepage
include header
« on: July 06, 2006, 06:55:56 pm »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: include header
« Reply #1 on: July 06, 2006, 07:18:25 pm »
#include <GL/glut.h>
I have the GL headers in H:/Program/src/include/GL
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mikethebike

  • Multiple posting newcomer
  • *
  • Posts: 24
    • Homepage
Re: include header
« Reply #2 on: August 08, 2006, 01:25:07 pm »
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



Offline mikethebike

  • Multiple posting newcomer
  • *
  • Posts: 24
    • Homepage
Re: include header
« Reply #3 on: August 09, 2006, 12:42:42 pm »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: include header
« Reply #4 on: August 09, 2006, 01:15:57 pm »
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mikethebike

  • Multiple posting newcomer
  • *
  • Posts: 24
    • Homepage
Re: include header
« Reply #5 on: August 09, 2006, 02:00:52 pm »
Hi Morten
  even if Im still a very beginner i believe to have past the stage of hello world also in C++. Im trying to compile a substantial VC++ 2005 program and as i only have VC2003 here which is not compatible ( M$  :? ) so i use cb. I looked in the makefile but cant find the needed libs. So all im trying is to avoid searching
hours on how to include plib. At least it took me a while to get to know that i needed to write glut and not Glut or whatever.
Well how could i extract the dep. libs from a VC++2005 project without VC++? Ahmm and how to know the linux syntax which is apparently differnt from windows.
THANKS for propositions.
Mcihael

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: include header
« Reply #6 on: August 09, 2006, 02:45:18 pm »
Without having a clue about plib at all myself...

$rpm -qpl http://dag.wieers.com/packages/plib/plib-1.8.3-1.1.fc2.dag.i386.rpm |grep -e "lib.*a$"
/usr/lib/libplibfnt.a
/usr/lib/libplibjs.a
/usr/lib/libplibnet.a
/usr/lib/libplibpsl.a
/usr/lib/libplibpu.a
/usr/lib/libplibpuaux.a
/usr/lib/libplibpw.a
/usr/lib/libplibsg.a
/usr/lib/libplibsl.a
/usr/lib/libplibsm.a
/usr/lib/libplibssg.a
/usr/lib/libplibssgaux.a
/usr/lib/libplibul.a


Thus: add ssg to your link libs...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: include header
« Reply #7 on: August 09, 2006, 03:22:57 pm »
There are several things not clear to me:
- what platform / compiler are you using (do you try to compile a VS2005 project on linux with GCC?)
- what libraries is your project using?

Please keep in mind that:
- there exists at least 3 different SDK's of e.g. plib: one for VC, one for MinGW, one for GCC (Linux)
- the same applies to glut and consorts

In addition: if you are using a "real" VS studio this ships with a "platform SDK". If you want to use VS2003Toolkit you'll need the platform SDK additionally to have all Win32 libs you'll require. If you port this application to Linux than this is more complex because there are no Win32 libraries, thus these depenedencies need to be taken care of.

Maybe you can explain a little better what exactly you are trying to do and provide us with an example project, if possible. Otherwise we can't really help you.

With regards, Morten.

Ps.: Don't you think that a plib newsgroup would serve you better in a first step...?! Here are certainly less (no?) plib experts that understand the dependencies and compiler specific issues.
« Last Edit: August 09, 2006, 03:24:40 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: include header
« Reply #8 on: August 09, 2006, 04:04:28 pm »
@mikethebike: please read the board description, specifically the part that says "This is NOT a general programming board".

Thank you.
Be patient!
This bug will be fixed soon...