Problems Building A Project

I start playing around with Panda in C++.

I have everything set up correctly (I think).

I am using Panda 1.7.1, with Microsoft Visual C++ 2008 Express Edition.

I get this message when I try to build a release:

1>------ Build started: Project: PandaTest, Configuration: Release Win32 ------
1>Linking...
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall BitMask<unsigned int,32>::~BitMask<unsigned int,32>(void)" (__imp_??1?$BitMask@I$0CA@@@QAE@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class BitMask<unsigned int,32> __cdecl BitMask<unsigned int,32>::bit(int)" (__imp_?bit@?$BitMask@I$0CA@@@SA?AV1@H@Z)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class BitMask<unsigned int,32> __cdecl BitMask<unsigned int,32>::lower_on(int)" (__imp_?lower_on@?$BitMask@I$0CA@@@SA?AV1@H@Z)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::main_loop(void)" (__imp_?main_loop@PandaFramework@@QAEXXZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class WindowFramework * __thiscall PandaFramework::open_window(void)" (__imp_?open_window@PandaFramework@@QAEPAVWindowFramework@@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::close_framework(void)" (__imp_?close_framework@PandaFramework@@QAEXXZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::open_framework(int &,char * * &)" (__imp_?open_framework@PandaFramework@@QAEXAAHAAPAPAD@Z)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall PandaFramework::~PandaFramework(void)" (__imp_??1PandaFramework@@UAE@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall PandaFramework::PandaFramework(void)" (__imp_??0PandaFramework@@QAE@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall WindowFramework::setup_trackball(void)" (__imp_?setup_trackball@WindowFramework@@QAEXXZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall WindowFramework::enable_keyboard(void)" (__imp_?enable_keyboard@WindowFramework@@QAEXXZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl Notify::out(void)" (__imp_?out@Notify@@SAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@XZ)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall PandaFramework::set_window_title(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?set_window_title@PandaFramework@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall TypeHandle::TypeHandle(void)" (__imp_??0TypeHandle@@QAE@XZ)
1>C:\Users\Sothh\Visual Studio 2008\Projects\PandaTest\Release\PandaTest.exe : fatal error LNK1120: 14 unresolved externals
1>Build log was saved at "file://c:\Users\Sothh\Visual Studio 2008\Projects\PandaTest\PandaTest\Release\BuildLog.htm"
1>PandaTest - 15 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am rather new in C++. Any ideas?

I’m guessing you didn’t include the proper set of library files in your project. This is a common mistake for C++ users (and you will probably find other threads in this forum where this problem is reported and solved if you search).

But if you are truly new to C++, my best suggestion will be to use Python instead. C++ is possible with Panda, but it’s not a very friendly language for newcomers, and if your goal is to develop quality games, you will find you can make a much higher-quality game for a given level of effort if you use Python.

David

Yeah, Panda is not the best engine to learn C++ with. If you don’t already know C++ and want to use Panda you should start with Python.

If however you really want to do it in C++, this is what I do. You are missing symbols for linkage so you have to locate what .lib files have those symbols, for example this line of the error log:

So I just look for the string “set_window_title” inside the lib files of Panda. I use cygwin and grep for this in c:\Panda-X.X.X\lib:

$ grep set_window_title *.lib
Binary file libp3framework.lib matches

Next is:

$ grep BitMask *.lib
Binary file libpanda.lib matches
Binary file libpandaegg.lib matches

Note that you are looking for a member that could exist in many classes, if you need to restrict your search sometimes, know that a function such as “PandaFramework::set_window_title” gets translated to set_window_title@PandaFramework in linker language., so if you are getting many matches for “set_window_title”, say, because it exists in many different classes, you can search for “set_window_title@PandaFramework” instead.

So you add those lib files to your project until you get no linking errors. But if you don’t know this stuff and you want to get a game done you better use python. If you really want to learn C++ you can perfectly use it with Panda (I do use it exclusively).

I followed the manual, and doubled checked my linking, but I will do as you said.

I am just playing around with this for now. I don’t have any plains for making a game in C++, I just thought it would be fun to see if I could get it to work.

Thanks,

Forets