Assertion Failed

Hello guys,
i’m new in the land of game programming and especially at using game engines(have some descent experiance at C++ programming). So straight to the problem, as a first i went to the manual. After going through it, i learned how to “connected” the engine to MSVS 2012, and did it. After that i tried to compile the code for Loading_the_Grassy_Scenery and after that - to execute it, but it allways gives me this error
I went around the forum and found out that this is because the nodePath.cxx is “empty”, but it shouldn’t be, because of this line - NodePath environ = window->load_model(framework.get_models(), “models/environment”); .
Yes, the path i put isn’t relative but exact - /c/Panda3D-1.8.1/…
And my question is - how can i fix this?

From the message, it says it is “Loading /d/Uni_Works/MVS_Panda/Panda/Release/models/environment.egg”. It wouldn’t say that if it couldn’t find the path, so that means it presumably did find and load your “models/environment” model.

The empty NodePath might be from some other part of the code, then, for some other NodePath. You can add the line:

assert-abort 1

to your Config.prc file to force an exception to be raised at the time of the assertion failure. This will make it easier to debug the error (you’ll at least be able to see the assertion in your call stack).

I assume that you’re developing this in C++.


Thank you for the replay.
Yes, i’m using C++. I put that command in the Config.prc but what am i supposed to expect it to do? And sorry i haven’t posted my code, here it is:

#include "pandaFramework.h"
#include "pandaSystem.h"
int main(int argc, char *argv[]) {
    // Load the window and set its title.
    PandaFramework framework;
    framework.open_framework(argc, argv);
    framework.set_window_title("My Panda3D Window");
    WindowFramework *window = framework.open_window();
    // Load the environment model.
    NodePath environ = window->load_model(framework.get_models(), "/d/Uni_Works/MVS_Panda/Panda/Release/environment.egg");
    // Reparent the model to render.
    // Apply scale and position transforms to the model.
    environ.set_scale(0.25, 0.25, 0.25);
    environ.set_pos(-8, 42, 0);
    // Run the engine.
    // Shut down the engine when done.
    return (0);

It is the same as the example as the link i posted the first time, but i can’t understand from where else it could detect another NodePath, after all i have only one NodePath? Could it be that the compilator/programming environment i am using to be the problem ?

When you add the assert-abort line to your Config.prc, it changes the behavior of an assertion failure, so that it will immediately raise a C++ exception, instead of continuing to execute. This means that if you run your program under the MSVS debugger, you will be able to see the stack trace at the time of the assertion failure, and you will know which line of your code triggered it.

I didn’t realize you had actually changed the path you are loading to the full and complete path. So my earlier assessment might be incorrect, maybe it isn’t finding the file at that location. Is that actually where the model file is found?

You can always check the result from load_model() before you do anything with it:

    // Load the environment model.
    NodePath environ = window->load_model(framework.get_models(), "/d/Uni_Works/MVS_Panda/Panda/Release/box.egg");
    cerr << "Loaded environ: " << environ << "\n";
    cerr << "is_empty: " << environ.is_empty() << "\n";


To answer your question - yes it is at that exact place.

I used those two lines that you gave me and it realy doesn’t load the model, for environ it doesn’t print anything and for is_empty prints 1. So it does try to load the model but can’t. That’s why i get the assertion failed message. If i’m wrong, correct me.

So i tried to put the model file in the same directory with the source code and for path i used only
this - “environment.egg”. After executing i get this If i’m not wrong this error comes from that one line in the Config file.

I think you might have some project settings mismatch between your project and Panda3D. This is a common problem with MSVS, and one of the most visible side-effects is that strings (such as filenames) are misinterpreted and are likely to cause crashes.

As for the particular assertion error, that’s triggered when sizeof(PN_int32) is not large enough to hold the address of the pointer passed into this function, which is only possible if something is wrong in your build settings somehow.


Okay, i went and made a new project and set it up this time about right. Now it tries to load the model but it gets another error:

About the first line i went around the forum and found out that the aplication can’t find the config file. The work around i found in one post is to copy the application in the bin directory. It works and it tries to load the model, but it says it doesnt recognize the extension…

It’s not finding etc/Config.prc, in particular. It is searched up from the location of the Panda3D dll, so if you manually copied dlls around, that must be what is causing the error.

What does the directory structure of your Panda3D copy look like?

About the copying, yes i did copy some dlls because the aplication needed them to start(in my project folder).
For the second thing you asked me - Panda3D copy directory structure, could you clarify what did you meanby that?

Instead of copying the DLLs to your project folder, you should instead add the directory containing the Panda3D DLLs to your PATH environment variable in your system settings.

If i’m not mistaken i already did that

Panda needs to find its libp3dtool.dll directory in the expected place, not in some other directory. It needs this because it looks for the Config.prc file relative to libp3dtool.dll, so if you copy the Panda dll’s to your project directory, you will cause it to fail to find Config.prc.

Be sure you remove the Panda dll’s from your project directory, and make sure the PATH correctly contains the directory that actually does contain these dll’s. If that’s not working, fix the PATH setting.


I downloaded and installed MSVC++ 2008 and tried to set up Panda3D there, and it worke perfectly without any issues. I used a guide form the internet that used Property Sheet that is added to the Release|Win32 folder in Properitives Manager. What i saw in that sheet i did in MSVS 2012 but it started to give some errors, the first one was that it couldn’t locate pandaFramework.h, even if the path was set in the Property Sheet. To fix it i set the path again in the Properitives menu of the whole project. It worked, i compiled the source and tried to debug it, at that moment i got this error

Error	1	error LNK2001: unresolved external symbol "__declspec(dllimport) protected: virtual float __thiscall PerspectiveLens::film_to_fov(float,float,bool)const " (__imp_?film_to_fov@PerspectiveLens@@MBEMMM_N@Z)	D:\Uni_Works\MVS_Panda\Panda\Panda\Source.obj	Panda

I went around and what i found out is that this error happens because i use different Platform Toolset( Visual Studio 2012(v110) ), i tried to set it to inherit from parent or project defaults but it said that i didn’t have MSVC++ 2010 installed. Any ideas why it can’t use the VS 2012 toolset ?

About the DLLs, the error was comming from the path i set in Environment(PATH="C:/Panda3D-1.8.1/bin) in the Debugging tab of Properitives, after removing it that error disappeared.

Excuse my bad manners. Thank you guys for helping me out! Any moderator out there, please mark this thread as solved.