User forums > General (but related to Code::Blocks)
CodeBlocks X11 Linking Issue
(1/1)
addy914:
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);
--- End code ---
OpenGL.hpp:
--- Code: ---#include <GL/GLX.h>
#include <X11/Xlib.h>
bool Init(Display *dis, Window win);
--- End code ---
OpenGL.cpp
--- Code: ---#include "openGL.hpp"
bool Init(Display *dis, Window win)
{
return true;
}
--- End code ---
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.
MortenMacFly:
You agreed to this when registering with the forum:
--- Quote from: CB_Forum_Rules on January 24, 2009, 09:14:54 pm ---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.
--- End quote ---
Topic locked.
Navigation
[0] Message Index
Go to full version