Advertisement

python and VC++ 6

Started by August 03, 2003 09:57 AM
2 comments, last by athos_musketeer 21 years, 3 months ago
I''m trying to compile an embebed application with python2.2 i''ve set the project to find the .h files here''s the code:
#include <Python.h>

int main( int argc, char *argv[] )
{
	
	Py_Initialize();

	Py_Finalize();
	return 0;
}
 
and here''s the error it''s giving me: LINK : fatal error LNK1104: cannot open file "python22_d.lib" i really can''t find that file anywhere. can anyone tell me how to set the project so everything compiles and links?
That file is only generated if you compiled python yourself, in debug mode. It is used to debug the python internals.

One way to make it use the release library is to #undef _DEBUG before the #include, but this may have side-effects, or to directly compile in ''Release'' mode :

In pyconfig.h line 213
/* 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#				pragma comment(lib,"python23_d.lib")#			else#				pragma comment(lib,"python23.lib")#			endif /* _DEBUG */#		endif /* _MSC_VER */#	endif /* Py_BUILD_CORE */#endif /* MS_COREDLL */


[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
Yeah, I had that problem too, because apparently python22_d.lib is not included with the released version (I''m sure you could BUILD it using the source, but who wants to do that?). So what I do is this:

#ifdef _DEBUG#undef _DEBUG#include <Python.h>#define _DEBUG#else#include <Python.h>#endif


Problem Solved (there aren''t enough errors in the python library to justify having a debug build anyway, as you''d never use the exported symbols anyway)

Chris Pergrossi
My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"

I LOVE YOU GUYS!!!!!! ))

This topic is closed to new replies.

Advertisement