FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Opengl programs won't compile (undefined reference)

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Thu Jul 05, 2007 9:56 am    Post subject: Opengl programs won't compile (undefined reference) Reply with quote

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 Smile


Last edited by arrow on Fri Jul 06, 2007 7:30 pm; edited 3 times in total
Back to top
View user's profile Send private message
Zweistein



Joined: 21 Mar 2007
Posts: 19

PostPosted: Thu Jul 05, 2007 2:37 pm    Post subject: Reply with quote

Hi,

With what Tool do you compile and how does it lok like? DMD? Rebuild? Bud?
Back to top
View user's profile Send private message
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Thu Jul 05, 2007 2:48 pm    Post subject: Reply with quote

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 Very Happy
Must have written something wrong before.
Thanks for your time anyway.
Back to top
View user's profile Send private message
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Thu Jul 05, 2007 7:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Jul 06, 2007 1:17 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Fri Jul 06, 2007 8:56 am    Post subject: Reply with quote

Sorry double..

Last edited by arrow on Fri Jul 06, 2007 9:00 am; edited 1 time in total
Back to top
View user's profile Send private message
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Fri Jul 06, 2007 8:58 am    Post subject: Reply with quote

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
View user's profile Send private message
arrow



Joined: 05 Jul 2007
Posts: 6

PostPosted: Fri Jul 06, 2007 7:09 pm    Post subject: Reply with quote

I installed rebuild instead of bud and now it compiles without any errors!

EDIT:..But it was segfaulting while running it Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group