News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

CodeBlocks X11 Linking Issue

Started by addy914, March 06, 2012, 01:20:27 PM

Previous topic - Next topic

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:
#include <GL/GLX.h>
#include <X11/Xlib.h>

Init(display, window);


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

bool Init(Display *dis, Window win);


OpenGL.cpp
#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.

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.
Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]