0

When I’m using for example FILE* pFile; or fstream file; after initializing fbx and Loading a FBX file, the programms stops and I get a invalid Heap error. I wasn’t able to find a solution for this problem. The Error comes right after the function

lImporter->Initialize(filename.c_str(), -1, pSdkManager->GetIOSettings());

Is this a common problem, is there a trick to use any IO class and FBX together?

Version = 2012.2

dll = fbxsdk-2012.2-mdd.lib

Visual Studio 2010 Pro.

Mathias Hölzl
  • 263
  • 4
  • 16
  • Does it cache the first argument, if so, when is `filename` destructed? – hmjd Jun 26 '12 at 16:30
  • lImporter->Initialize is part of a function and filename is the parameter. The wired thing is that if i dont use fstream of FILE* in the whole proj. the function works fine. – Mathias Hölzl Jun 26 '12 at 16:53
  • The soultion was to set a allocater class. bxSdkManager::SetMemoryAllocator(&lMyMemoryAllocator); It is mentioned in the Examples which came with the SDK. – Mathias Hölzl Jun 26 '12 at 19:40

1 Answers1

0

Change your File* to char[]. This should resolve your crashing problem:

char fileName[] = "file.fbx";

Model yourModel (fileName);

FBX SDK will read your model as is (no need to include fstream in this case).

(If it doesn't work, upgrade to the lastest FBX SDK 2013. I'm using VS2012)