lib3ds

Started by
7 comments, last by huymoi7 11 years ago

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.

Advertisement

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.

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.

20702231.jpg
  • 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?

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

Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).

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.

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

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.
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.

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.

63978376.png
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)
49273218.png

This topic is closed to new replies.

Advertisement