Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: addy914 on March 06, 2012, 01:20:27 pm

Title: CodeBlocks X11 Linking Issue
Post by: addy914 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
#include <GL/GLX.h>
#include <X11/Xlib.h>

Init(display, window);

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

bool Init(Display *dis, Window win);

OpenGL.cpp
Code
#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.
Title: Re: CodeBlocks X11 Linking Issue
Post by: MortenMacFly 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.