Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: liban8 issues  (Read 9508 times)

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
liban8 issues
« on: December 13, 2015, 07:52:07 am »

Hello, i am trying to setup liban8 to load .an8 models in a c++ aplication but for some reason i can't pull it off. When i link liban8*.lib and compile i get this bunch of errors:

Code: [Select]
Warning .drectve `/DEFAULTLIB:"libcpmtd" /include:?id@?$codecvt@DDH@std@@2V0locale@2@A /DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Warning .drectve `/DEFAULTLIB:"libcpmtd" /include:?id@?$codecvt@DDH@std@@2V0locale@2@A /DEFAULTLIB:"LIBCMTD" /DEFAULTLIB:"OLDNAMES" ' unrecognized
liban8_MTd.lib(\Release\AN8XMath_Quaternion.obj) (.text+0x155): undefined reference to `__security_cookie'

The undefined reference repeats many times. Liban8 came with 4 different .lib but i didn't know which one to use so i tried them all, one by one with the same results except for the warning which changes, the one above is for MT or MTd and the one below is for MD or MDd:

Code: [Select]
Warning .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.DebugCRT' version='9.0.21022.8'
processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"msvcprtd" /manifestdependency:"type='win32'
name='Microsoft.VC90.DebugCRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRTD" /DEFAULTLIB:"OLDNAMES" ' unrecognized

I've also tried adding the source code to my project to avoid using the .lib but i guess i did it wrong because it doesn't compile, however no errors are showed. I wasn't sure what to add so i added them all. I've tried compiling on Dev-C++ v5.11 and on wxDev-C++ v7.4.2 and i am on WinXP SP2 32bits.

PS: also the linked libs are these:

Code: [Select]
libSOIL.a
liban8_MDd.lib
-opengl32
-gdi32
-glu32
-mwindows
« Last Edit: December 13, 2015, 07:54:29 am by omutomata »
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: liban8 issues
« Reply #1 on: December 13, 2015, 10:23:27 am »

Are you using visual studio?  I think in my program I just used the .cpp/.h files directly and worked fine, never tried the .lib.  Not sure what version visual studio, but the lib should match your version, and make sure MD, etc, match your settings in project properties - C/C++ - Code Generation - Runtime Library.  You can see it successfully used in my tool ( http://goldeneyevault.com/viewfile.php?id=255 )...maybe will help.  It should be similar in whatever compiler you use, I imagine, just including the cpp/h.


Basically just:
#include "Liban8/An8Loader.h"

An8File an8File;

   if( an8File.LoadFile(string((LPCTSTR)(inputFile))) == false)
   {
      return false;
   }
« Last Edit: December 13, 2015, 10:29:01 am by SubDrag »
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: liban8 issues
« Reply #2 on: December 13, 2015, 10:46:52 am »

As SubDrag said,I think the best way is to include the source code into your project.That's what I do.I use Visual C++ 2010 express.
Logged

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: liban8 issues
« Reply #3 on: December 13, 2015, 03:04:09 pm »

Thank you both for replying. I did what you suggested SubDrag even before i wrote this topic but figured was too stupid because i didn't linked the .lib and didn't bother to mention this. I've seen the code u posted in the Documentation folder that came with the source code however when i do this:

Code: [Select]
#include "An8Loader.h"

An8File an8File;

   if( an8File.LoadFile(string((LPCTSTR)(inputFile))) == false)
   {
      return false;
   }

i get this error:

Code: [Select]
undefined reference to `An8File::An8File()'|
undefined reference to `An8File::LoadFile(std::string)'|

Note that both An8Loader.h and AN8X.h are in the same directory as my project and i've managed to include other .h the same way in the same project.
I've moved my code from Dev-C++ (which gave me the above error) to Code:Blocks only to see the same error again... As for VC++ i hate it. Tried to get 2010 version but it can only be installed on Win XP SP3 or higher and i am running SP2 so i got 2008 version but i need to change the code so much to make it work...

Here is a sample of my code:

Code: [Select]
#include <windows.h> // Header File For Windows
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include "NeHeGL.h" // Header File For NeHeGL
#include <math.h> // We'll Need Some Math
#include "SOIL.h"                                     // Header File For The SOIL Library
#include "An8Loader.h"                                          // Header File For Anim8tor Loader Library

............................................

void LoadModel()
{
An8File* an8File = new An8File(); // Don't forget delete at the end


if( an8File->LoadFile("test.an8") == false ) // Load file in memory
{
MessageBox(NULL,"Failed To Load Model.","ERROR",MB_OK|MB_ICONEXCLAMATION);
}
}

GLinit()
GLUpdate()
GLDraw()
................................

Also i've tried changing my code to yours but same thing happens. Got any other tips for me?
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: liban8 issues
« Reply #4 on: December 13, 2015, 03:44:43 pm »

Do you also have the .cpps in the folder?  They are where the implementation is stored (if you don't use the lib).  In mine I kept it all in the liban8 folder, and #include it that way. 

I used VS2008 for Obj2An8.
« Last Edit: December 13, 2015, 03:45:00 pm by SubDrag »
Logged

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: liban8 issues
« Reply #5 on: December 13, 2015, 05:25:24 pm »

Yes i've put the .h and .cpp from objtoan8 in the right folder but i get the same error.... Just to make sure i am not doing anyting stupid:
1. Succesfully compiled the program without #include "liban8\An8Loader.h".
2. Added #include "liban8\An8Loader.h" (just this header) to my program.
3. Copied liban8 folder with all containing .h and .cpp to where my project is located. (Up until this point i can still compile)
4. Added An8File an8File;

   if( an8File.LoadFile(std::string((LPCTSTR)(inputFile))) == false)
   {
      return false;
   }

and received error. Also where in An8Loader.h is LoadFile? All i see there is:

Code: [Select]
// Load a .an8 file
bool LoadFile(std::string file_name);
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: liban8 issues
« Reply #6 on: December 13, 2015, 08:36:24 pm »

Yeah that's the header.  It's in An8File.cpp.   Perhaps it can't find that file, try adding everything to your project.    Although in visual studio, you'd be able to compile, but not link, if it could find the .h but didn't find the .cpp
« Last Edit: December 13, 2015, 08:37:17 pm by SubDrag »
Logged

omutomata

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: liban8 issues
« Reply #7 on: December 15, 2015, 10:05:55 am »

You were right, after i've added all .cpp files to the project and included An8Loader.h i've managed to compile everything but i get an warning (i've made it short taking only relevant information):

Code: [Select]
\liban8\AN8X_SkinnedMeshHelper.cpp In member function `void AN8XFigureHelper::ProcessNode(An8File*, std::vector<AN8XBone, std::allocator<AN8XBone> >*,
std::vector<AN8XObjectInstanceInFigure*, std::allocator<AN8XObjectInstanceInFigure*> >*, std::vector<An8Mesh*, std::allocator<An8Mesh*> >*,
std::vector<int, std::allocator<int> >*, std::vector<AN8XMATRIX, std::allocator<AN8XMATRIX> >*, std::vector<An8Material*, std::allocator<An8Material*> >*, int, An8Bone*, AN8XMATRIX*)':

[Warning] passing NULL used for non-pointer converting 1 of `void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'

The line that spawns this warning is present two times in AN8X_SkinnedMeshHelper.cpp and is this one:

Code: [Select]
MeshesListMaterialsID.push_back(NULL);
I've googled the warning and found some posts saying that it cannot convert from pointer to int and that i should use ptrnull instead but that also got me to an error:

Code: [Select]
\liban8\AN8X_SkinnedMeshHelper.cpp [Error] no matching function for call to `std::vector<int, std::allocator<int> >::push_back(const ptrnull_t&)'
Anyway, ignoring the warning i've tried rendering the model but i guess i'm doing something wrong there too... made a function by following the documentation that came with liban8 like this:

Code: [Select]
void LoadModel()
{
 An8File an8File;

 glLoadIdentity(); // Reset The View
 glTranslatef(0.0f, 0.0f,-2.0f);
 if( an8File.LoadFile(std::string((LPCTSTR)("test.an8"))) == false)
 {
    MessageBox(NULL,"Failed To Load Model.","ERROR",MB_OK|MB_ICONEXCLAMATION);;
 }
 // Compute mesh position in object space (avoid the need of translation)
 an8File.ComputeAllPositions();

 // Ungroup meshes (easier to manipulate)
 an8File.Ungroup();

 // Triangulize faces
 an8File.Triangulize();

 // Compute matices of camera, objects, Lights, ... from quaternions
 an8File.ComputeAllMatrices();

 // Computer integer id to joint texture and material (.an8 files use strings)
 an8File.ComputeTextureIDForMaterial();
}

Then i've ran this function in Draw() but all i see on the screen is the quad i drew to make the program work before adding liban8.
Btw thank you for the help you provided so far.
Logged

SubDrag

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: liban8 issues
« Reply #8 on: December 15, 2015, 07:29:08 pm »

It's hard to say, but admittedly you use a lot of functions I don't use.  If it helps, try examining my source. I parsed out the data it gave me and used it all myself. It's all recursive nodes, so maybe not at the right spot.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: liban8 issues
« Reply #9 on: December 15, 2015, 08:48:34 pm »

omutomata
Liban8 is not a rendering lib.It provides a comprehensive data
structure containing everything from the an8 file + utility
functions.

Reading SubDrag's code will show you how to access the data,
but not how to render since it's a converter.It's probably not
rendering,but writing to a file in obj format.

Something else could also help.
On the site of Liban8,you will find GLAn8Viewer.It's a demo using Liban8 to render an an8 model.

Claude
Logged