[PyQt] Compiler Error using SIP: error C3861: 'PyUnicode_FromFormat': identifier not found

Jamie Riotto jamie.riotto at gmail.com
Sun Oct 25 21:45:44 GMT 2009


Hi,
I'm trying to learn to use SIP, and I've started out with a simple
Vector class. The sip file looks like this:

===========================================================================
%Module Vec3 0

class Vec3 {

%TypeHeaderCode
#include "Vec3.h"
%End

public:

	float x;
	float y;
	float z;	

	Vec3();
	Vec3(float xpos,float ypos,float zpos);
	float getX();
	float getY();
	float getZ();
	SIP_PYOBJECT __repr__() const;
%MethodCode
	sipRes = PyUnicode_FromFormat("Vec3(%f, %f, %f)", sipCpp->getX(),
sipCpp->getY(), sipCpp->getZ());
%End
};

==============================================================================

The __repr__ section is my frist attempt at implementing python
functions (operators next). I've used QPoint.h and QPoint.sip
as my starting point. The c++ code compiles ok , but when I try to
compile SIP with the following makefile,

I get the following error:

sipvec3Vec3.cpp
vec3.sip(26): error C3861: 'PyUnicode_FromFormat': identifier not found

Any suggestions? Thanks - jamie

============================================================================
TARGET = vec3.pyd
OFILES = sipvec3cmodule.obj sipvec3Vec3.obj
HFILES = sipAPImesh.h

CC = cl
CXX = cl
LINK = link
CPPFLAGS = -DNDEBUG -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -I. -I..
-Ic:\python25\include -Ic:\python25\sip
CFLAGS = -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3
CXXFLAGS = -nologo -Zm200 -Zc:wchar_t- -O2 -MD -W3 -w34100 -w34189
LFLAGS = /NOLOGO /DLL /MANIFEST /MANIFESTFILE:$(TARGET).manifest
/SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32'
name='Microsoft.Windows.Common-Controls' version='6.0.0.0'
publicKeyToken='6595b64144ccf1df' language='*'
processorArchitecture='*'" /INCREMENTAL:NO
LIBS = /LIBPATH:c:\python25\libs ..\lib\vec3.lib c:\python25\site_packages
.SUFFIXES: .c .cpp .cc .cxx .C


{.}.cpp{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.cc{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.cxx{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.C{}.obj::
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

{.}.c{}.obj::
	$(CC) -c $(CFLAGS) $(CPPFLAGS) -Fo @<<
	$<
<<

all: $(TARGET)

$(OFILES): $(HFILES)

$(TARGET): $(OFILES)
	$(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
	  $(OFILES) $(LIBS)
<<
	mt -nologo -manifest $(TARGET).manifest -outputresource:$(TARGET);2

install: $(TARGET)
	@if not exist c:\python25\Lib\site-packages mkdir c:\python25\Lib\site-packages
	copy /y $(TARGET) c:\python25\Lib\site-packages\$(TARGET)

clean:
	-del $(TARGET)
	-del sipveccmodule.obj
	-del sipvecVec3.obj
	-del $(TARGET).manifest

===========================================================================


More information about the PyQt mailing list