Running panda on Visual Studi 2003

Elo, another problem…

I’ve tried to compile the first c++ tutorial,but there is a problem-it does not compile-I get “LINK : fatal error LNK1104: cannot open file ‘python25_d.lib’” error message
I’ve added C:\Panda3D-1.5.3\include&C:\Panda3D-1.5.3\python\include,as well as the lib paths,into my VS directiories

this solution I’ve found doesn’t help https://discourse.panda3d.org/viewtopic.php?t=1921

You are trying to compile a Debug build of Panda. Since you don’t also have a Debug build of Python, that won’t be possible–you should compile a Release build instead.

Still, I’m not sure that we still support VS 2003. You might need to upgrade to VS 2005 or VS 2008; I’m not 100% sure which is the officially support compiler now.

David

The degug verions aren’t provided?!Then how I’m susposed to debug a project?

well,that helped a little,but now I get these errors:

Panda1.obj : error LNK2019: unresolved external symbol “public: void __thiscall PandaFramework::close_framework(void)” (?close_framework@PandaFramework@@QAEXXZ) referenced in function _main
Panda1.obj : error LNK2019: unresolved external symbol “public: void __thiscall PandaFramework::main_loop(void)” (?main_loop@PandaFramework@@QAEXXZ) referenced in function _main
Panda1.obj : error LNK2019: unresolved external symbol “public: class WindowFramework * __thiscall PandaFramework::open_window(void)” (?open_window@PandaFramework@@QAEPAVWindowFramework@@XZ) referenced in function _main
Panda1.obj : error LNK2019: unresolved external symbol “public: void __thiscall PandaFramework::open_framework(int &,char * * &)” (?open_framework@PandaFramework@@QAEXAAHAAPAPAD@Z) referenced in function _main
Panda1.obj : error LNK2019: unresolved external symbol “public: __thiscall PandaFramework::PandaFramework(void)” (??0PandaFramework@@QAE@XZ) referenced in function _$E23
Panda1.obj : error LNK2019: unresolved external symbol “public: virtual __thiscall PandaFramework::~PandaFramework(void)” (??1PandaFramework@@UAE@XZ) referenced in function _$E24

Is there a need to add some other libraries in linker’s additional dependencies than python25.lib?

It’s Python that doesn’t provide a debug version of its library. It has nothing to do with Panda. You can certainly go get one from python.org (but you might have to build it yourself).

Alternatively, you can build Panda without Python. If your intention is to use it as a C++ library, you don’t need Python anyway. You might, though, still have issues with all of the other third-party libraries that you want to use, like libpng and libjpeg–you’ll need debug versions of all of these.

In any case, you don’t actually need to make a Debug build in order to debug a project. The Debug build just introduces a different runtime heap that makes certain kinds of debugging easier; but it is still perfectly possible to debug C++ code without it. (We won’t go into the whole philosophical debate of why Microsoft decided to provide two completely incompatible build forms and the problems that causes for everyone.)

As to your link error, it sounds like you didn’t link with libframework.dll, another part of Panda.

David

thanks David,libp3framework.lib that’s what was needed (I guessed it on my own)

but now I’m trying to load some model,and: I’ve got a lot of new errors similiar to before…please list mi the full needed libraries to add them to the linker

I’m not 100% sure what the full list is, but why not simply add all of the lib’s in the panda directory?

David

there are linking errors still:

Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle TypeHandle::_none” (?_none@TypeHandle@@0V1@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle TypedObject::_type_handle” (?_type_handle@TypedObject@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle ReferenceCount::_type_handle” (?_type_handle@ReferenceCount@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class Thread * Thread::_main_thread” (?_main_thread@Thread@@0PAV1@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle TypedWritable::_type_handle” (?_type_handle@TypedWritable@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle TypedWritableReferenceCount::_type_handle” (?_type_handle@TypedWritableReferenceCount@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle CachedTypedWritableReferenceCount::_type_handle” (?_type_handle@CachedTypedWritableReferenceCount@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “class MemoryHook * memory_hook” (?memory_hook@@3PAVMemoryHook@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle CopyOnWriteObject::_type_handle” (?_type_handle@CopyOnWriteObject@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle PandaNode::_type_handle” (?_type_handle@PandaNode@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle NodePathComponent::_type_handle” (?_type_handle@NodePathComponent@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle PandaNode::CData::_type_handle” (?_type_handle@CData@PandaNode@@0VTypeHandle@@A)
Panda1.obj : error LNK2001: unresolved external symbol “private: static class TypeHandle NodePathComponent::CData::_type_handle” (?_type_handle@CData@NodePathComponent@@0VTypeHandle@@A)

maybe something else is required,not only the libraries?

Yes, this most likely indicates that you are missing the WIN32_VC preprocessor definition.

Though, I’m not sure whether it will still work. Panda3D has been compiled with MSVC 2005, not 2003 – I recommend upgrading to 2005. (Not all the way to 2008 though.) It’s possible that it might still work though.

hmmmm…you mean,something like #define WIN32_VC is needed?OK, let’s try it…

but by the way,why such important thing is not mentioned in tutorial?

Yes, I think a #define would work, but you can also set it in the project settings (which I think is done usually.)

Because the one who made that tutorial used Linux :slight_smile: But honestly, I thought VC automatically defined that symbol.
But yes, you’re right, this would be worth mentioning. We should also have more C++ sample programs (and ready-to-use VC projects for those.)

ehhhhhhhh, #define WIN32_VC didn’t help :confused:

maybe I show you the code

#define WIN32_VC
#include "stdafx.h"//inside,there are the references to pandaFramework.h and pandaSystem.h


int main(int argc,char *argv[])
{
	PandaFramework framework;
   //open a new window framework
	framework.open_framework(argc, argv);
    //set the window title to My Panda3D Window
	 framework.set_window_title("My Panda3D Window");
    //open the window
	WindowFramework *window = framework.open_window();

  //here is room for your own code
	NodePath ufo=window->load_model(0,"escort fighter.x");//stighly changed in comparision to the manual
	ufo.reparent_to(window->get_render());

    //do the main loop, equal to run() in python
	framework.main_loop();
    //close the window framework
	framework.close_framework();
	return (0);
}

and those libraries are added to the linker’s dependencies:
python25.lib libp3framework.lib libp3dtool.lib libp3dtoolconfig.lib libpanda.lib libpandaexpress.lib

if you have vs 2005,please try to compile and link that code (with other model of course :wink:)

Oh yeah,that would be most appreciated.
But as you can see,samples does not solve the question about configuring ex. Visual Studio enviroment.You know,a programmer,wchitch knows what he/she is intended to arichve,is able to find of his/her own what to do if you provide a good documentation.Let’s take the lights for examle:
you described the types of lights,and then I want to create an ambient light.So I search the reference about the AmbientLight class,and see what is interesting to me.And writing something like
LightNode *light=AmbientLight();
can be write by any person who knows C++,and does not need to be seen in a sample-and those who does not,first shoud learn the language itself.
So if I would recommend some changes,that would be the better classes desriptions inside the reference,with links to other classes that might be needed while using the class (ex. AmbientLight is bounded with LightNode,and that is connected do PandaNode,if I’ve understood it correctly),and what library that class needs to be added to linker.The second advice is mentioned earlier full VS configuration guide for using Panda,with listed all needed libraries,macros,and so on.

Are you using the prebuilts, or did you generate your own libraries with makepanda.py or ppremake? If you’ve got panda building with ppremake (we use it to build panda on vs 2003), you can see examples of code linking into panda in the src/testbed directory. In fact, pview, one of the core model viewing tools, is built there.

edit-MakePanda.py should also support building pview, so you can look there for another example of building an app.