Getting Assertion failed error, compiling panda Hello world

The Panda3D “Hello World” code present in Panda3D Manual, successfully compiled and executed. In the output display screen it gives a error
" Assertion failed: _is_open at line 188 of c:\p\p3d\panda3d-1.6.2\panda\src\frame
work\pandaFramework.cxx"

I believe due to this error there is no animation displayed on the screen, its a blank window.

Are you sure you called open_framework()? The assertion error indicates a failure to call that method first.

David

Hm, my guess is that you accidentally put an open_window call before having called open_framework.

EDIT: Oops, David wins

Its true I did not call framwork.open_framework(argc,argv) because, I am able to compile it successfully but during execution I am getting a run time error…

“Unhandled exception at 0x76d2b09e in Panda3D.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f728…”

so how to avoid this ?

Sounds like a typical Release<>Debug mismatch, are you sure you are compiling in Release mode (which is what the downloadable Panda build is compiled in) ?

I am using Micrsoft Visual Studio 2005, version 8.0.5XXXX,

and i followed the steps to compile it in release mode… i.e.

Only after doing these i am atleast able to compile the program…
Executable Files
C:\Panda3D-1.6.2\bin
Include Files
C:\Panda3D-1.6.2\python\include
C:\Panda3D-1.6.2\include
Library Files
C:\Panda3D-1.6.2\python\Lib
C:\Panda3D-1.6.2\python\libs
C:\Panda3D-1.6.2\lib

Step three: Add libraries

libp3framework.lib
libpanda.lib
libpandafx.lib
libpandaexpress.lib
libp3dtool.lib
libp3dtoolconfig.lib
libp3pystub.lib
libp3direct.lib

Are these errors because I am using VB 2005 than VB 2008 which was said in manual ?

Uh, yes. It’s important to use VC2008 and not VC2005. Note that there’s a free Express version of VC++ available at the Microsoft website.

Thanks a lot for the quick replies. I will install VC2008 and try scripting. Your support is very much appreciable.

I installed VC++ 2008, and tried the hello world program. I got the same error once again.

Unhandled exception at 0x7614b09e in Panda3D.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f728…

should we provide any command line arguments for executing the program at command prompt ?

or just

C:XXXX \debug>ProgName.exe , will work ?

below is the hello world code which i tried to compile…

#include “pandaFramework.h”
#include “pandaSystem.h”
#include “iostream”
#include “iomanip”
#include “fstream”

using namespace std;

PandaFramework framework;

int main(int argc, char * argv) {
//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

cout<<"\n trying to run a Panda code in VB \n ";

//do the main loop, equal to run() in python

framework.main_loop();
//close the window framework
framework.close_framework();

system(“pause”);
return (0);
}

Again, you need to be compiling in release mode, not in debug mode.

I tried it in release mode only…

what exactly to convert to release mode…

I tried in the following way to convert to release mode… is this correct…
or should we something else ?

and i followed the steps to compile it in release mode… i.e.

Only after doing these i am atleast able to compile the program…
Executable Files
C:\Panda3D-1.6.2\bin
Include Files
C:\Panda3D-1.6.2\python\include
C:\Panda3D-1.6.2\include
Library Files
C:\Panda3D-1.6.2\python\Lib
C:\Panda3D-1.6.2\python\libs
C:\Panda3D-1.6.2\lib

Step three: Add libraries

libp3framework.lib
libpanda.lib
libpandafx.lib
libpandaexpress.lib
libp3dtool.lib
libp3dtoolconfig.lib
libp3pystub.lib
libp3direct.lib

Those aren’t the steps to select release mode, they’re just to set up compilation paths. Look at the top of your IDE, for a drop-down box that says “Debug”. Click the drop-down button and select “Release” instead. Then follow those steps and rebuild.

Problem running the program not yet resolved.

Before positing the question… I thought of doing it on my own… but I was not successful…

I was just following all the steps as specified in the manual:

panda3d.org/manual/index.php/T … on_Windows

  1. Installed all the required s/w components
  2. Downloaded the source code “Panda3D-1.6.2-win32.zip”, renamed as panda_source and pasted in C drive.
  3. changed the path to C:\panda_source and executed the command makepanda\makepanda.bat
  4. i dont understand what --everything means…

Is the source code required for running programs present in manuals ?

Forgot to tell one more thing…

Using VC++ 2008 and keeping the mode in “release”, I was getting errors at executing time…

Using VC++ 2008 and keeping the mode in “release”, I was getting errors at executing time…

1>Linking…
1>PandaThreeD.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>PandaThreeD.obj : error LNK2001: unresolved external symbol (_imp??1NodePath@@QAE@XZ)

1>C:\Documents and Settings\Corvus2\Desktop\PandaThreeD\Release\PandaThreeD.exe : fatal error LNK1120: 21 unresolved externals
1>Build log was saved at “file://c:\Documents and Settings\Corvus2\Desktop\PandaThreeD\PandaThreeD\Release\BuildLog.htm”
1>PandaThreeD - 22 error(s), 22 warning(s)

and command window says. unable to start…myprogname.exe

OK, my apologies, I don’t really understand what you’re attempting. You’re trying to build just a C++ application that uses Panda, right? That means you don’t need to attempt to build Panda itself, so there’s no reason to mess around with makepanda, and no reason to add the Panda source code into your project.

The only thing your project should contain is: “Release” mode setting, the list of include paths to the Panda header files, the list of Panda libraries, and your own application source code.

I think you may also need to set your project to the “Multithreaded DLL” runtime, but I’m not sure about that.

Still, these sorts of problems kind of come with the territory when you’re working with C++, especially under Windows. There are lots of options to fiddle with in your project settings, and if you get any of them wrong, it won’t build, or it won’t run, or it will crash in mysterious ways.

I’m guessing you’re a little bit new at C++ development. If you don’t mind my asking, are you sure that C++ is the right language for you to be working in? Panda3D provides excellent Python bindings, and it’s usually much easier to dive right in and write a great program using Python. Plus, the application you write in Python is more often than not better than the same application you would have written in C++, because you can devote more of your time towards writing the application itself, and less dealing with fiddly language requirements.

There are certainly good reasons to work in C++, but a lot of times people have a mistaken idea about the relative advantages of C++ and Python. I just want to make sure you haven’t overlooked a better choice.

David

I have no idea of Python, I am comfortable with C++. I believe once I get the program successfully executed, I can do extensive work and try to edit the objects displayed.

So I dont understand why I am getting errors at linking time.

I set the project to “release” mode settings, included list of libraries…

Can you throw some light on

  1. Include paths to Panda header files
  2. Set the project to “Multithreaded DLL” runtime ?

and do we have any video tutorials(youtube or anything) on running panda using C++ on windows ?

please help we out fast, as my deadline to complete this task is getting close…

on working in release mode… a release folder is created but there is no .exe file created after compilation, due to which on execution it says the system cannot find the file specified.

So I tried executing in normal debug mode, I am able to execute and see the output screen but with run time exceptions like,

“Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.”

on executing on Release mode .exe file is not getting created, how to get it ?