Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I need to import a complex fbx model into C++. By complex I mean that it has a lot of vertices,cameras and so on.As far as I saw this is done using the ViewScene sample.I want to take that sample and make a new project but it gives me some linking errors such as:

1>  main.cpp
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall     SceneContext::SceneContext(char const *,int,int,bool)" (??0SceneContext@@QAE@PBDHH_N@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "bool __cdecl InitializeOpenGL(void)" (?InitializeOpenGL@@YA_NXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall SceneContext::~SceneContext(void)" (??1SceneContext@@QAE@XZ) referenced in function "public: void * __thiscall SceneContext::`scalar deleting destructor'(unsigned int)" (??_GSceneContext@@QAEPAXI@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SceneContext::SetCurrentAnimStack(int)" (?SetCurrentAnimStack@SceneContext@@QAE_NH@Z) referenced in function "void __cdecl CreateMenus(void)" (?CreateMenus@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall SceneContext::OnTimerClick(void)const " (?OnTimerClick@SceneContext@@QBEXXZ) referenced in function "void __cdecl TimerCallback(int)" (?TimerCallback@@YAXH@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SceneContext::LoadFile(void)" (?LoadFile@SceneContext@@QAE_NXZ) referenced in function "void __cdecl DisplayCallback(void)" (?DisplayCallback@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall SceneContext::OnDisplay(void)" (?OnDisplay@SceneContext@@QAE_NXZ) referenced in function "void __cdecl DisplayCallback(void)" (?DisplayCallback@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall SceneContext::OnReshape(int,int)" (?OnReshape@SceneContext@@QAEXHH@Z) referenced in function "void __cdecl ReshapeCallback(int,int)" (?ReshapeCallback@@YAXHH@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall SceneContext::OnKeyboard(unsigned char)" (?OnKeyboard@SceneContext@@QAEXE@Z) referenced in function "void __cdecl KeyboardCallback(unsigned char,int,int)" (?KeyboardCallback@@YAXEHH@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall SceneContext::OnMouse(int,int,int,int)" (?OnMouse@SceneContext@@QAEXHHHH@Z) referenced in function "void __cdecl MouseCallback(int,int,int,int)" (?MouseCallback@@YAXHHHH@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall     SceneContext::OnMouseMotion(int,int)" (?OnMouseMotion@SceneContext@@QAEXHH@Z) referenced in function "void __cdecl MotionCallback(int,int)" (?MotionCallback@@YAXHH@Z)
1>D:\LuminusCore\Debug\LuminusCore.exe : fatal error LNK1120: 11 unresolved externals

I have added the Fbx includes/libs to the project, but I would like to know what else should I add in order to get rid of those errors.

Later Edit:

Sorry forgot to mention, I am using visual C++ 2010.

share|improve this question
    
This question's a little too specific to your exact current compiler error, so it will likely be closed. If you'd like to get help before that happens, it'll help others help you if you put in your compile command, or if you're using an IDE, your list of linked libs. SceneContext:: is in the FBX lib, or is it part of some example common lib shared amongst the samples? –  michael.bartnett Mar 4 '13 at 14:07
    
edited the question. –  user1640736 Mar 4 '13 at 14:45
1  
Your problem is not with importing fbx files, it's with project set up. You just happened to be trying to import fbx files at the time. I believe this question is too localized for the site. Google on how to solve unresolved external symbols. –  Byte56 Mar 4 '13 at 16:31
1  
you are missing some sort of dependency in your project. Most likely it is whatever dll you are using to import your model, you should probably take a step back from this, create your own simple dll (just expose basic math functions) then follow a tutorial on how to use your external dll in a test application. I realize this is a bit round a bout, but you can apply the lessons learned from this kind of example to solve your problem. –  Benjamin Danger Johnson Mar 4 '13 at 17:18

1 Answer 1

Regarding errors it looks like you have declarations but forgot to add definitions of virtual methods in derived class.

I don't know how you import fbx file content into your project but you can do the following (works in VS2012, I don't have access to VS2010 to check it):

  • add fbx files as assets
  • in build customization add MeshContentTask from your_visual_studio_path\Common7\IDE\Extensions\Microsoft\VsGraphics\
  • make sure fbx files have property Item Type set to Mesh Content Pipeline
  • before compiling your main program Visual Studio will convert fbx files into cmo files and extract textures if they are packed together (into your debug folder by default)
  • you have to parse cmo which is binary file yourself, it's fairly easy. You can find specification (and how to do this) in DirectX Tool Kit (ModelLoadCMO.cpp). Name of the converted file will be same as fbx but with cmo extension.

Edit: Be aware FBX files can either be binary or ASCII and either contain paths to textures or having textures packed inside. You can use FBX Converter 2013 by Autodek to switch and pack/unpack textures.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.