Sign in to follow this  
huymoi7

lib3ds

Recommended Posts

huymoi7    122

Hi I am trying to load a 3ds model into OpenGL. I did some research and found that lib3ds is a popular solution.

https://code.google.com/p/lib3ds/

I read this tutorial on how to use it, which wasn't too hard

www.donkerdump.nl/node/207

but after downloading the zip folder and unzipping I have no idea how to install it.

 

I've never really installed a library before, is there a generic tutorial on how to do this?

 

I am using code blocks.

 

Is lib3ds is a good solution for this?

 

If so could I get some instructions for installing lib3ds into codeblocks.

 

Cheers.

Share this post


Link to post
Share on other sites
wintertime    4108

There is not really much to install for a library. Just put all librarys in a subfolder of some common folder like C:\libs, compile the library if it doesnt come precompiled and then add search paths for preprocessor and linker and the actual librarys to the projects. You can make this a bit easier if you go to settings, global variables in code::blocks and add one with the path you can then reference in all your projects instead of typing in the whole paths everytime.

You can find enough information on that in the codeblocks wiki.

Edited by wintertime

Share this post


Link to post
Share on other sites
huymoi7    122

There is no .dll files or .lib files (just .h, .cpp and some make files). So does that mean I do not link anything?

 

I redirected my compiler in code blocks to the folder with the lib3ds h files (settings->compiler->search directories tab).

 

Here is a picture of my problem.

 

 

[url=http://imageshack.us/photo/my-images/442/20702231.jpg/]20702231.jpg[/URL]
 
 
  • It detects the included header file <lib3ds.h>
  • It understands the type Lib3dsFile from <lib3ds.h> 
  • but I can't get it to understand the function 'lib3ds_file_open'. It gives me an "undefined reference to 'lib3ds_file_open' error.

 

but when I hover my mouse over the function it displays the function prototype (as seen in the .h file), I also went to the included .h file for <lib3ds.h> and checked that the function is there (which it is).

 

Why can I detect the lib3ds.h file, read in a struct from it, but fail to find a reference to the lib3ds_file_open function?

Edited by huymoi7

Share this post


Link to post
Share on other sites
KnolanCross    1974

Are you sure there is no lib files? Haven't you downloaded a linux version and there is a so file?

 

This is a linker error, maybe you need to compile from the source?

 

The linker options are here, but without lib files, there isn't much you can do:

Settings > Compiler and Debbuger > linker settings

Share this post


Link to post
Share on other sites
wintertime    4108

I already said if the library does not come precompiled you have to compile the library first. If it doesnt exist you cannot link your project with it.

Look for documentation of the library on how to compile it, typically there is a file called readme or usage! If there are makefiles you are probably supposed to use make with one of them.

Share this post


Link to post
Share on other sites
huymoi7    122

Hey so the readme file just gave me a link to the website in which to download it but there is a file called "INSTALL", but it gives me instructions on how to compile it in linux and I am working in windows.

 

Is there a way to run make files in windows? Or do I have download it on linux, precompile it there and transfer it to my windows machine?

 

Cheers

Share this post


Link to post
Share on other sites
kidman171    498
You can compile makefiles on windows with MinGW32-make. Just check in your mingw installation and see if there is a binary called mingw32-make. If so, open a command prompt, cd to the folder with the makefile in it, and run mingw32-make.

Share this post


Link to post
Share on other sites
huymoi7    122
Alright so I used MSYS to help me compile the library using a ./configure -> make -> make install process.

It gave me some new files in the lib3ds directory, as per below


75903236.png

It appears that each .c file is given a .o and .ol file, there is also two new directories (there is also a .la file). The .deps directory is full .pol files and .libs directory is full of .o files.

Does this look right? There still are no .lib or .dll files.

I linked the Codeblocks compiler (Settings -> Compiler -> Search Directories -> Linker) and set them both to the src folder. It didn't work. I then proceeded to set every folder in lib3ds (i.e. ./lib3ds, ./lib3ds/src, ./lib3ds/src/.libs, ./lib3ds/src/.deps), but still the error says


43500337.png

I feel like I'm so close I'm following instructions as far as I can tell perfectly but it still just won't work. Does the compilation look right? Any suggestions please? Thanks in advance. Edited by huymoi7

Share this post


Link to post
Share on other sites
huymoi7    122

Just a hypothesis but, when I've installed other libraries (opengl, glut, sdl) in the past I often have to edit the linker settings via "Build options". i.e.

 

 

[url=http://imageshack.us/photo/my-images/560/63978376.png/]63978376.png[/URL]
 
Could there be something I need to do here (I ask because I know it's specifically a linker problem)? 
 
Lastly here is what my "Search directories" tab looks like (in case it helps)
 
[url=http://imageshack.us/photo/my-images/341/49273218.png/]49273218.png[/URL]
 
 
Edited by huymoi7

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this