Unresolved External Symbol

I"m just trying to get my hello world example, but I’m getting linker errors:

Error
1	error LNK2001: unresolved external symbol "public: void __thiscall PandaFramework::open_framework(int &,char * * &)" (?open_framework@PandaFramework@@QAEXAAHAAPAPAD@Z)	main.obj	PandaTest
Error	2	error LNK2001: unresolved external symbol "public: virtual __thiscall PandaFramework::~PandaFramework(void)" (??1PandaFramework@@UAE@XZ)	main.obj	PandaTest
Error	3	error LNK2001: unresolved external symbol "public: __thiscall PandaFramework::PandaFramework(void)" (??0PandaFramework@@QAE@XZ)	main.obj	PandaTest
Error	4	fatal error LNK1120: 3 unresolved externals	C:\Documents and Settings\mike\My Documents\Visual Studio 2008\Projects\PandaTest\Release\PandaTest.exe	PandaTest

I have C:\Panda3D-1.5.4\lib included as a library directory. Should this not provide the needed definitions?

This is the code that is crashing:

#include "pandaFramework.h"
#include "pandaSystem.h"

PandaFramework g_Framework;

int main(int argc, char* argv[])
{
	g_Framework.open_framework(argc, argv);

	return 0;
}

This is defined in libp3framework.lib. You need to add that library to your project. Probably wouldn’t hurt to add all of the libraries in that directory.

David

That fixed it. Thanks!

Now I’m getting another unresolved external error when I declare a NodePath. I included C:\Panda3D-1.5.4\lib*.*. Am I still missing something? Is there maybe a list of all required libraries and headers I can use to ensure I have everything?

What is the unresolved symbol?

David

That would probably be a helpful piece of information…

Error	1	error LNK2001: unresolved external symbol "private: static class TypeHandle ReferenceCount::_type_handle" (?_type_handle@ReferenceCount@@0VTypeHandle@@A)	main.obj	PandaTest
Error	2	error LNK2001: unresolved external symbol "private: static class TypeHandle CachedTypedWritableReferenceCount::_type_handle" (?_type_handle@CachedTypedWritableReferenceCount@@0VTypeHandle@@A)	main.obj	PandaTest
Error	3	error LNK2001: unresolved external symbol "private: static class TypeHandle TypedWritableReferenceCount::_type_handle" (?_type_handle@TypedWritableReferenceCount@@0VTypeHandle@@A)	main.obj	PandaTest
Error	4	error LNK2001: unresolved external symbol "private: static class TypeHandle PandaNode::_type_handle" (?_type_handle@PandaNode@@0VTypeHandle@@A)	main.obj	PandaTest
Error	5	error LNK2001: unresolved external symbol "class MemoryHook * memory_hook" (?memory_hook@@3PAVMemoryHook@@A)	main.obj	PandaTest
Error	6	error LNK2001: unresolved external symbol "private: static class TypeHandle CopyOnWriteObject::_type_handle" (?_type_handle@CopyOnWriteObject@@0VTypeHandle@@A)	main.obj	PandaTest
Error	7	error LNK2001: unresolved external symbol "private: static class TypeHandle TypeHandle::_none" (?_none@TypeHandle@@0V1@A)	main.obj	PandaTest
Error	8	error LNK2001: unresolved external symbol "private: static class TypeHandle PandaNode::CData::_type_handle" (?_type_handle@CData@PandaNode@@0VTypeHandle@@A)	main.obj	PandaTest
Error	9	error LNK2001: unresolved external symbol "private: static class TypeHandle TypedObject::_type_handle" (?_type_handle@TypedObject@@0VTypeHandle@@A)	main.obj	PandaTest
Error	10	error LNK2001: unresolved external symbol "private: static class TypeHandle TypedWritable::_type_handle" (?_type_handle@TypedWritable@@0VTypeHandle@@A)	main.obj	PandaTest
Error	11	error LNK2001: unresolved external symbol "private: static class TypeHandle NodePathComponent::_type_handle" (?_type_handle@NodePathComponent@@0VTypeHandle@@A)	main.obj	PandaTest
Error	12	error LNK2001: unresolved external symbol "private: static class TypeHandle NodePathComponent::CData::_type_handle" (?_type_handle@CData@NodePathComponent@@0VTypeHandle@@A)	main.obj	PandaTest
Error	13	fatal error LNK1120: 12 unresolved externals	C:\Documents and Settings\mike\My Documents\Visual Studio 2008\Projects\PandaTest\Release\PandaTest.exe	PandaTest

It looks to me like you failed to define the WIN32_VC symbol when you were compiling. This is required to tell Panda to emit the syntax required to import these symbols from the DLL (Windows requires a special extended syntax to import symbols, for some reason, instead of sensibly importing all external symbols like other OS’s do).

David

Oh. I don’t recall seeing steps to do that. Perhaps I missed it in a tutorial somewhere? I don’t see it in the getting started stuff, or the Hello World tutorial. How might I do this?

Hmm, I’m sure we used to have a “how to compile Panda on Visual Studio” page, but it seems to be gone. Maybe someone took it down because it had gotten out-of-date or something, and it hasn’t been replaced yet.

Just add WIN32_VC to the list of defined symbols in the project settings.

David

Yeah, Josh removed it. Here’s a link to the old page:
panda3d.org/manual/index.php?title … oldid=4381

If I get more time, I’ll work on C++ samples and ship VC projects with em.

That fixed it. Thanks!