0

I have just started a project c++ with Panda3D. ( Visual Studio 2010 )

With a simple HelloWorld, I add paths etc. No compile error except :

an error just appeared :

 error LNK1104: cannot open file 'python27_d.lib' 

And I have no idea how to fix it.

Plz help !

Thanks !

F4Ke
  • 1,631
  • 1
  • 20
  • 49
  • You need to modify the python installation bundled with panda to fix this. You can however just switch to "Release" and compile without a problem. If I remember correctly there was a header file that had a `#ifdef _DEBUG` which then linked to the `python27_d.lib`. Alternatively you can try to find and download or build yourself a debug version of python 2.7 with Visual Studio 2010. – PeterT Oct 28 '13 at 13:42
  • Which version of Panda3D are you using? The 1.8.1 version is incompatible with MSVC 2010, if you want to use MSVC 2010, you need to use a recent buildbot build (click "devel" on the download page). – rdb Nov 09 '13 at 14:35

1 Answers1

1

There's a few things you can do.

1) just build in release mode (not a good solution, since you can't debug too well this way)

2) add another build configuration based on "Release" but with debug symbols and without the _DEBUG preprocessor definition (can mess up some libraries)

3) find or build a Python 2.7 version with debug and release libraries build in Visual Studio 2010

4) just change this one section in the pyconfig.h where it actually links to the *.lib file to just use the python27.lib for both configurations.

/* For an MSVC DLL, we can nominate the .lib files used by extensions */
#ifdef MS_COREDLL
#   ifndef Py_BUILD_CORE /* not building the core - must be an ext */
#       if defined(_MSC_VER)
            /* So MSVC users need not specify the .lib file in
            their Makefile (other compilers are generally
            taken care of by distutils.) */
#           ifdef _DEBUG
#       //-----------------------change the next line-------------//
#               pragma comment(lib,"python27_d.lib") 
#           else
#               pragma comment(lib,"python27.lib")
#           endif /* _DEBUG */
#       endif /* _MSC_VER */
#   endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */

1) 2) and 4) are hacky solutions, so I'd suggest you try to use 3).

PeterT
  • 7,981
  • 1
  • 26
  • 34
  • I've just tried all off this, but doesn't work. The build config on Release made other compile error -> doesn't find the lib panda3d ... – F4Ke Oct 28 '13 at 14:35
  • have you added the right libraries in both configurations? They're completely seperate. So if you add the *.lib files to link in debug you still need to add them for release (unless you add them in "All Configurations"). So make sure you've added all necessary directories and files in both configurations. – PeterT Oct 28 '13 at 14:38
  • You should compile in Release mode, don't define _DEBUG, and don't define NDEBUG either. Compiling in Release mode doesn't mean it's impossible to debug - you can still enable debugging symbols if you want. – rdb Nov 09 '13 at 14:32