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

I'm lost with importing and linking...

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



Joined: 01 Jan 2011
Posts: 2
Location: Seoul, Korea

PostPosted: Tue Jan 11, 2011 8:44 pm    Post subject: I'm lost with importing and linking... Reply with quote

I'm using DDT (eclipse plugin) and trying to use Derelict 2.

I've builded it as written in the documentation, and some files have been generated in DERELICT\lib and DERELECT\import

I typed this in complie options.

Code:
-ID:\Jun\Programming\D\lib\Derelict\import
-ID:\Jun\Programming\D\lib\Derelict\lib\DerelictGL.lib
-ID:\Jun\Programming\D\lib\Derelict\lib\DerelictGLU.lib
-ID:\Jun\Programming\D\lib\Derelict\lib\DerelictSDL.lib
-ID:\Jun\Programming\D\lib\Derelict\lib\DerelictUtil.lib


I compiled and got these errors.

Code:
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _D8derelict3sdl3sdl11DerelictSDLC8derelict3sdl3sdl17DerelictSDLLoader
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _D8derelict6opengl2gl10DerelictGLC8derelict6opengl2gl16DerelictGLLoader
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _SDL_Init
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _SDL_GL_SetAttribute
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _SDL_SetVideoMode
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _SDL_Quit
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _D8derelict3sdl3sdl12__ModuleInfoZ
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _D8derelict6opengl3glu12__ModuleInfoZ
bin\OpenGLTest.obj(OpenGLTest)
 Error 42: Symbol Undefined _D8derelict6opengl2gl12__ModuleInfoZ


I think I'm doing wrong with linking lib files. Should I use dsss(if I should, please let me know how to use it)? please help me!
Back to top
View user's profile Send private message
bioinfornatics



Joined: 22 Jun 2010
Posts: 90

PostPosted: Wed Jan 12, 2011 11:52 pm    Post subject: Reply with quote

you need add complier flag such as:
-L-ldl
-L-lDerelictGL
-L-lDerelictGLU
-L-lDerelictSDL
-L-lDerelictUtil
Back to top
View user's profile Send private message
blings



Joined: 01 Jan 2011
Posts: 2
Location: Seoul, Korea

PostPosted: Thu Jan 13, 2011 7:08 am    Post subject: solved! Reply with quote

Very Happy
Thank you for the reply! Actually, it did not work but you help me to find out what was missing with my build command. Idea
Back to top
View user's profile Send private message
ryutenchi



Joined: 09 Dec 2010
Posts: 8

PostPosted: Mon Feb 07, 2011 5:44 pm    Post subject: Reply with quote

whenever I try to add
Code:
-L-ldl
it always says:
Code:
Error: unrecognized switch '-ldl'


Any ideas? using Dmd2.

UPDATE Got it working. Had a screwy flag in my /etc/dmd.conf.
Back to top
View user's profile Send private message
Zardoz



Joined: 28 May 2011
Posts: 17
Location: Spain

PostPosted: Sat May 28, 2011 4:03 am    Post subject: Reply with quote

I have a similar problem. I'm using Eclipse wich DDT,
I just pus in dmd.conf this :

... -I/usr/include/d/Derelict2/import -L-ldl -L-lDerelictGL -L-lDerelictGLU -L-lDerelictSDL -L-lDerelictUtil

I install Derelict2 from svn in /usr/include/d/Derelict2

I get this errors when i try to compile :
/usr/bin/ld: cannot find -lDerelictGL
/usr/bin/ld: cannot find -lDerelictGLU
/usr/bin/ld: cannot find -lDerelictSDL
/usr/bin/ld: cannot find -lDerelictUtil
collect2: ld returned 1 exit status

And the program is :
import std.stdio;
import derelict.sdl.sdl;

void main () {

writeln("Aja");
DerelictSDL.load();
}

So, why it can find the libs to link ???
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Sat May 28, 2011 9:43 pm    Post subject: Reply with quote

Zardoz wrote:
So, why it can find the libs to link ???


Most likely because you didn't put the Derelict libraries on the link path. If that's the case, you need to tell the linker where to find them. I'm not a Linux user, but I assume it will be:

-L-L/path/to/libraries

Also, it's probably not a good idea to put all of that in DMD.conf. You'll have to update it every time you install a new version of DMD. Better to put it in the project settings.

Alternatively, you can use pragmas in the source code, using the full path to the libraries:

pragma(lib, "/path/to/libraries/libDerelictSDL.a");

In which case you don't need to add anything on the command line.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Zardoz



Joined: 28 May 2011
Posts: 17
Location: Spain

PostPosted: Mon May 30, 2011 3:03 am    Post subject: Reply with quote

Thanks! Ok, I move it to proyect settings wichout any problem, and I actually i not have any problem wich Derelict SDL ( I can compile basic examples wichout any problems), but wich DerelictGL I have problems....

I try this :
Code:

import derelict.opengl.gl;
import derelict.sdl.sdl;
import derelict.util.compat;

void main () {
      
   writeln("Aja");   
  DerelictGL.load();
}


And i get this gigant error/warring mensages from the linker :
Code:

/usr/bin/ld: Warning: type of symbol `glClearIndex' changed from 2 to 1 in /usr/include/d/Derelict2/lib//libDerelictGL.a(glfuncs.o)
/usr/bin/ld: Warning: type of symbol `glClearColor' changed from 2 to 1 in /usr/include/d/Derelict2/lib//libDerelictGL.a(glfuncs.o)
/usr/bin/ld: Warning: type of symbol `glClear' changed from 2 to 1 in /usr/include/d/Derelict2/lib//libDerelictGL.a(glfuncs.o)
/usr/bin/ld: Warning: type of symbol `glIndexMask' changed from 2 to 1 in /usr/include/d/Derelict2/lib//libDerelictGL.a(glfuncs.o)
/usr/bin/ld: Warning: type of symbol `glColorMask' changed from 2 to 1 in /usr/include/d/Derelict2/lib//libDerelictGL.a(glfuncs.o)
...... (many pages like)

/usr/include/d/Derelict2/lib//libDerelictGL.a(extloader_163_ad5.o): In function `_D8derelict6opengl9extloader29load_GL_GREMEDY_string_markerFZE8derelict6opengl7gltypes16GLExtensionState':
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader29load_GL_GREMEDY_string_markerFZE8derelict6opengl7gltypes16GLExtensionState+0x3f): undefined reference to `_D8derelict4util6compat9toDStringFPxaZAya'
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader29load_GL_GREMEDY_string_markerFZE8derelict6opengl7gltypes16GLExtensionState+0x71): undefined reference to `_D8derelict4util6compat7findStrFAyaAyaZi'
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader29load_GL_GREMEDY_string_markerFZE8derelict6opengl7gltypes16GLExtensionState+0x9f): undefined reference to `_D8derelict4util6compat9toCStringFAyaZPxa'
/usr/include/d/Derelict2/lib//libDerelictGL.a(extloader_164_c0c.o): In function `_D8derelict6opengl9extloader32load_GL_GREMEDY_frame_terminatorFZE8derelict6opengl7gltypes16GLExtensionState':
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader32load_GL_GREMEDY_frame_terminatorFZE8derelict6opengl7gltypes16GLExtensionState+0x3f): undefined reference to `_D8derelict4util6compat9toDStringFPxaZAya'
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader32load_GL_GREMEDY_frame_terminatorFZE8derelict6opengl7gltypes16GLExtensionState+0x71): undefined reference to `_D8derelict4util6compat7findStrFAyaAyaZi'
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader32load_GL_GREMEDY_frame_terminatorFZE8derelict6opengl7gltypes16GLExtensionState+0x9f): undefined reference to `_D8derelict4util6compat9toCStringFAyaZPxa'
...... (too many pages like this)

/usr/include/d/Derelict2/lib//libDerelictGL.a(extloader_165_a54.o): In function `_D8derelict6opengl9extloader27load_GL_MESAX_texture_stackFZE8derelict6opengl7gltypes16GLExtensionState':
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader27load_GL_MESAX_texture_stackFZE8derelict6opengl7gltypes16GLExtensionState+0x3f): undefined reference to `_D8derelict4util6compat9toDStringFPxaZAya'
derelict/opengl/extloader.d:(.text._D8derelict6opengl9extloader27load_GL_MESAX_texture_stackFZE8derelict6opengl7gltypes16GLExtensionState+0x71): undefined reference to `_D8derelict4util6compat7findStrFAyaAyaZi'
collect2: ld returned 1 exit status


For me looks like there a error linking wich OpenGL libs and/or I missed to install some opengl-dev package.

I'm compiling wich :
-I/usr/include/d/Derelict2/import -L-L/usr/include/d/Derelict2/lib/ -L-ldl -L-lglut -L-lGL -L-lGLU -L-lDerelictSDL -L-lDerelictUtil -L-lDerelictGL -L-lDerelictGLU

Note : Removing or adding -L-lglut -L-lGL -L-lGLU, not changes anything
Back to top
View user's profile Send private message
Zardoz



Joined: 28 May 2011
Posts: 17
Location: Spain

PostPosted: Mon May 30, 2011 3:32 am    Post subject: Reply with quote

AutoAnswer:

OK, I find a previus post wich a similar problem.... (http://www.dsource.org/forums/viewtopic.php?p=26799&sid=ed338468d1d099d801f1d8e5d3c36a4f) So
1) I moved all .a lib files of Derelict to /usr/local/lib/derelict2/
2) I'm compiling wich :
Code:
 -I/usr/include/d/Derelict2/import -L-L/usr/local/lib/derelict2/ -L-ldl -L-lDerelictUtil -L-lDerelictSDL -L-lDerelictGL -L-lDerelictGLU

3) I put this pragma :
Code:
pragma(lib, "/usr/local/lib/derelict2/libDerelictUtil.a");



Now works wich dmd
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Mon May 30, 2011 7:21 am    Post subject: Reply with quote

Zardoz wrote:
Note : Removing or adding -L-lglut -L-lGL -L-lGLU, not changes anything


That's because you do not need to link to any of those libraries to use Derelict. Derelict loads the shared libraries manually, so you don't need to link with any of them on the command line at compile time. And GLUT has nothing to do with any of this anyway.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
aldacron



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

PostPosted: Mon May 30, 2011 7:23 am    Post subject: Reply with quote

Zardoz wrote:

3) I put this pragma :
Code:
pragma(lib, "/usr/local/lib/derelict2/libDerelictUtil.a");


This is redundant. In 2), you are already passing DerelictUtil on the command line. You can remove this line and it should work.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Zardoz



Joined: 28 May 2011
Posts: 17
Location: Spain

PostPosted: Tue May 31, 2011 4:16 pm    Post subject: Reply with quote

I know, andlike I said, I have the same problem that is showed in aprevius post. DMD 2.052 have some strange problem linking, and wichout these pragma, not links well DerelictUtil.

I'm sorry that you not read my last line that said "Now works with dmd"...

In any case, thanks.
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