Author Topic: CodeBlocks X11 Linking Issue  (Read 3467 times)

addy914

  • Guest
CodeBlocks X11 Linking Issue
« on: March 06, 2012, 01:20:27 pm »
I am working on a client with GL, GLX, and X11 with Ubuntu 11.10. I am getting a linking error, and I can't seem to figure out why. This one peice of code is what causes it, and if I remove it, it works fine.

Main.cpp:
Code: [Select]
#include <GL/GLX.h>
#include <X11/Xlib.h>

Init(display, window);

OpenGL.hpp:
Code: [Select]
#include <GL/GLX.h>
#include <X11/Xlib.h>

bool Init(Display *dis, Window win);

OpenGL.cpp
Code: [Select]
#include "openGL.hpp"

bool Init(Display *dis, Window win)
{
return true;
}
The error I get is: "Undefined reference to 'OpenGL::Init(_XDisplay*, unsigned long)'.
The weirdest part about is that when I remove the dis parameter completely, the error disappears.

I just gave you the crucial parts, if you would like more code to get a background of whats going on then I would be happy to do so. The only thing I have linked in -lGL.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: CodeBlocks X11 Linking Issue
« Reply #1 on: March 06, 2012, 04:40:57 pm »
You agreed to this when registering with the forum:
2. Compiler/Linker errors are NOT Code::Blocks errors. Usually, C++ newcomers tend to confuse the Editor/IDE (Code::Blocks) with the Compiler (MINGW / GCC). You may see some errors in the compiler output because you missed to do something right in your code. But that's not Code::Blocks troubleshooting, that's C++ troubleshooting and does not belong in here. If your program doesn't compile, READ THE C++ MANUAL.
Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ