[C++-sig] for python library file

Sascha Jensen sascha at askja.de
Fri Apr 29 08:36:38 CEST 2005



jianbing wu wrote:
> Hi guys,
> I am currently write a C++ program which will use the
> "python24.lib", but when I compiled my program under
> the debug version, the .Net compiler complains not
> finding "pythod24_d.lib" (as I knew this library file
> is only used for debugging purpose). But I cannot find
> it in the python installation folder. Would someone
> please give me this file or tell me how to create this
> file?

in pyconfig.h is defined to use python24_d.lib


#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
#				pragma comment(lib,"python24_d.lib")
#			else
#				pragma comment(lib,"python24.lib")
#			endif /* _DEBUG */
#		endif /* _MSC_VER */
#	endif /* Py_BUILD_CORE */
#endif /* MS_COREDLL */


i used this inside my header to undefine _DEBUG for the Python lib, 
because i did not need debugging

#ifdef _DEBUG
#undef _DEBUG
#include "Python.h"
#define _DEBUG
#else
#include "Python.h"
#endif

probably there is a more elegant way, but this works fine for me,
Sascha




More information about the Cplusplus-sig mailing list