View previous topic :: View next topic |
Author |
Message |
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Thu Jul 05, 2007 9:56 am Post subject: Opengl programs won't compile (undefined reference) |
|
|
Hi, I followed the guide on how to install derelict.
But when I try to compile anything is shows this:
Code: |
/tmp/ccd5ZAZu.o: In function `_Dmain':
der.d:(.text+0x34): undefined reference to `_D8derelict6opengl2gl10DerelictGL4loadFAaZv'
/tmp/ccd5ZAZu.o:(.data+0x60): undefined reference to `_D8derelict6opengl2gl12__ModuleInfoZ'
collect2: ld returned 1 exit status
Compilation failed.
|
What I tried to compile was really nothing:
Code: |
import derelict.opengl.gl;
void main()
{
DerelictGL.load();
// now you can call OpenGL functions
}
|
My system:
Core 2 duo amd62 | gentoo linux | gcc 4.1.2 with "d" use-flag (gentoo way)
(I used the install script provided)
Please help
Last edited by arrow on Fri Jul 06, 2007 7:30 pm; edited 3 times in total |
|
Back to top |
|
|
Zweistein
Joined: 21 Mar 2007 Posts: 19
|
Posted: Thu Jul 05, 2007 2:37 pm Post subject: |
|
|
Hi,
With what Tool do you compile and how does it lok like? DMD? Rebuild? Bud? |
|
Back to top |
|
|
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Thu Jul 05, 2007 2:48 pm Post subject: |
|
|
Zweistein wrote: | Hi,
With what Tool do you compile and how does it lok like? DMD? Rebuild? Bud? |
I just followed the howto again and it worked now
Must have written something wrong before.
Thanks for your time anyway. |
|
Back to top |
|
|
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Thu Jul 05, 2007 7:58 pm Post subject: |
|
|
I have a new problem now.
When I'm doing:
Code: | import derelict.opengl.gl |
It will show me "undefined reference" errors.
However,
Code: | import derelict.sdl.sdl |
works.
I'm compiling with:
build -L-ldl -op -I/usr/local/d/DerelictSDL -I/usr/local/d/DerelictGL -I/usr/local/d/DerelictUtil "path/to/file.d" |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Fri Jul 06, 2007 1:17 am Post subject: |
|
|
arrow wrote: | I have a new problem now.
When I'm doing:
Code: | import derelict.opengl.gl |
It will show me "undefined reference" errors. |
Can't help you if we don't know what the errors are. Please post them here. Also, let us know which version of DMD or GDC you are using.
Quote: |
I'm compiling with:
build -L-ldl -op -I/usr/local/d/DerelictSDL -I/usr/local/d/DerelictGL -I/usr/local/d/DerelictUtil "path/to/file.d" |
FYI, you can shorten down that command line by running install.d and copying all of the derelict modules into a single 'derelict' source tree. For example:
dmd -run install.d /usr/local/d/import
This will create a /usr/local/d/import/derelict directory, with all of the modules in the appropriate place. Then the command line becomes:
build -L-ldl -op -I/usr/local/d/import path/to/file.d _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Fri Jul 06, 2007 8:56 am Post subject: |
|
|
Sorry double..
Last edited by arrow on Fri Jul 06, 2007 9:00 am; edited 1 time in total |
|
Back to top |
|
|
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Fri Jul 06, 2007 8:58 am Post subject: |
|
|
I made the path smaller and now it looks like this:
Code: |
build -O -L-ldl -op -I/usr/local/d sdl.d
/usr/local/d/derelict/opengl/gl.o: In function `_D8derelict6opengl2gl7loadAllFC8derelict4util6loader9SharedLibZv':
gl.d:(.text+0x11): undefined reference to `loadPlatformGL'
/usr/local/d/derelict/opengl/gl.o: In function `_D8derelict6opengl2gl10DerelictGL15hasValidContextFZb':
gl.d:(.text+0x122): undefined reference to `glXGetCurrentContext'
/usr/local/d/derelict/opengl/gl.o: In function `_D8derelict6opengl2gl10DerelictGL17getCurrentContextFZT8derelict6opengl3glx10GLXContext':
gl.d:(.text+0x144): undefined reference to `glXGetCurrentContext'
/usr/local/d/derelict/opengl/gl.o:(.data+0x268): undefined reference to `_D8derelict6opengl3glx12__ModuleInfoZ'
collect2: ld returned 1 exit status
|
And sdl.d looks like this:
Code: |
import derelict.opengl.gl;
int main() {
return 0;
}
|
I' using gdc (latest I think, how can I check? (gcc: 4.1.2) with bud
System: amd64 gentoo
And SDL+opengl works with c++ |
|
Back to top |
|
|
arrow
Joined: 05 Jul 2007 Posts: 6
|
Posted: Fri Jul 06, 2007 7:09 pm Post subject: |
|
|
I installed rebuild instead of bud and now it compiles without any errors!
EDIT:..But it was segfaulting while running it |
|
Back to top |
|
|
|