Panda3D Linking Errors

Hey yall! I’m currently having trouble with linking the Panda3D Libraries to an executable I’m wanting to use, but I get the following Link errors,

main.cxx.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int panda_version_1_10" (__imp_?panda_version_1_10@@3HA) referenced in function "public: int __thiscall CheckPandaVersion<void>::check_version(void)" (?check_version@?$CheckPandaVersion@X@@QAEHXZ)

And this is what my main.cxx file looks like (I’m wanting to compile python source to C using Pypperoni):

main.cxx: (EDIT: This is the updated file, but I continue to get the same errors)

#include <pandabase.h>

#include <Python.h>

// P3D Python modules initers.
#ifdef WIN32
#define _P3D_INIT(MODULE) extern "C" __declspec(dllexport) PyObject PyInit_##MODULE ();
#else
#define _P3D_INIT(MODULE) extern "C" void init##MODULE ();
#endif

_P3D_INIT(core)
_P3D_INIT(direct)
_P3D_INIT(fx)
_P3D_INIT(egg)
_P3D_INIT(ode)
_P3D_INIT(physics)
_P3D_INIT(interrogatedb)

// P3D CXX fwd decls.
#ifdef WIN32
void init_libwgldisplay();
void init_libwindisplay();
#elif __APPLE__
void init_libcocoadisplay();
#elif __linux
void init_libglxdisplay();
#endif
void init_libmovies();
void init_libpnmimagetypes();
void init_libmotiontrail();

static void panda_prepare()
{
    PyInit_core();

    // Setup the display.
#ifdef WIN32
    init_libwgldisplay();
    init_libwindisplay();
#elif __APPLE__
    init_libcocoadisplay();
#elif __linux
    init_libglxdisplay();
#endif

    // Setup audio.
    init_libmovies();

    // Setup pnmimagetypes.
    init_libpnmimagetypes();

    // Setup MotionTrail
    init_libmotiontrail();

    // Init other modules.
    PyInit_interrogatedb();
    PyInit_direct();
    PyInit_egg();
    PyInit_fx();
    PyInit_ode();
    PyInit_physics();
};

Any help is appreciated, (And if I’m doing this all the wrong way, PLEASE let me know!

EDIT: Here is my CMakeLists.txt file aswell…

Welp, silly me forgot to use #include “windows.h”

EDIT: Nevermind, just saw new errors, so I thought that might fix it, but I’m back to: error LNK2019: unresolved external symbol "__declspec(dllimport) int panda_version_1_10" (__imp_?panda_version_1_10@@3HA) referenced in function "public: int __cdecl CheckPandaVersion<void>::check_version(void)" (?check_version@?$CheckPandaVersion@X@@QEAAHXZ

Alright, I managed to get passed the error for “Unresolved External Symbol”

But now I get multiple LNK2005 errors (Already defined in libpy.panda3d.*)
Such as…

libpy.panda3d.direct.lib(direct_module.obj) : error LNK2005: "struct Dtool_MappingWrapper * __cdecl Dtool_NewMappingWrapper(struct _object *,char const *)" (?Dtool_NewMappingWrapper@@YAPEAUDtool_MappingWrapper@@PEAU_object@@PEBD@Z) already defined in libpy.panda3d.core.lib(core_module.obj)

Once again, any feedback is welcome here :slight_smile:

Figured it out, didn’t run “makepanda” without the “–static” option xD