On Sun, 6 Feb 2011 21:06:49 +0100, Kermit <[email protected]> wrote: > hi, > > i've a problem with a simple Sip compilation ( and my first tentative ) > > a simple class: > > //__________________________________ > #ifndef Vector_h__ > #define Vector_h__ > > namespace KitCG > { > > class Vec2 > { > public: > //------------------- > // Access to elements > //------------------- > > float x; > float y; > > //------------- > // Constructors > //------------- > > Vec2 (); // no initialization > explicit Vec2 (float a); // (a a) > Vec2 (float a, float b); // (a b) > > }; > > Vec2::Vec2 () > { > // empty > } > > > > Vec2::Vec2 (float a) > { > x = y = a; > } > > > > Vec2::Vec2 (float a, float b) > { > x = a; > y = b; > } > } > > #endif // Vector_h__ > > //__________________________________ > > > the corresponding Vector.sip > > //_________________________________________________ > %Module Vec2 0 > > class Vec2 > { > %TypeHeaderCode > #include "Vector.h" > %End > > > public: > > float x; > float y; > > Vec2 (); // no initialization > explicit Vec2 (float a); // (a a) > Vec2 (float a, float b); // (a b) > > > }; > //_________________________________________________ > > My configure.py > //_________________________________________________ > import os > import sipconfig > from PyQt4 import pyqtconfig > > moduleName= "Vector" > build_file = moduleName+".sbf" > > config = pyqtconfig.Configuration() > > qt_sip_flags = config.pyqt_sip_flags > > print " ".join([config.sip_bin, "-c", ".", "-b", build_file, > moduleName+".sip"]) > > os.system(" ".join([config.sip_bin, "-c", ".", "-b", build_file, > moduleName+".sip"])) > > installs = [] > > installs.append([moduleName+".sip", > os.path.join(config.default_sip_dir, moduleName)]) > > makefile = pyqtconfig.QtCoreModuleMakefile( > configuration=config, > build_file=build_file, > installs=installs > ) > > makefile.extra_libs = [moduleName] > > makefile.generate > > //_________________________________________ > > and i've this error > > > cl -c > -*************************************************************************** > sipVec2Vec2.cpp > .\sipVec2Vec2.cpp(30) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(37) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(44) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(51) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(68) : error C2065: 'Vec2' : undeclared identifier > .\sipVec2Vec2.cpp(68) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(73) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(73) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(75) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(84) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(84) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(86) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(96) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(96) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(98) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(103) : error C4430: missing type specifier - int assumed. > Note: C++ does not support default-int > .\sipVec2Vec2.cpp(103) : error C2143: syntax error : missing ';' before '*' > .\sipVec2Vec2.cpp(103) : error C2065: 'a0' : undeclared identifier > .\sipVec2Vec2.cpp(105) : error C2065: 'a0' : undeclared identifier > .\sipVec2Vec2.cpp(107) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(107) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(109) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(121) : error C2065: 'Vec2' : undeclared identifier > .\sipVec2Vec2.cpp(121) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(121) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(123) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(123) : error C2227: left of '->x' must point to > class/struct/union/generic type type is ''unknown-type'' > .\sipVec2Vec2.cpp(133) : error C2065: 'Vec2' : undeclared identifier > .\sipVec2Vec2.cpp(133) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(133) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(140) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(140) : error C2227: left of '->x' must point to > class/struct/union/generic typetype is ''unknown-type'' > .\sipVec2Vec2.cpp(150) : error C2065: 'Vec2' : undeclared identifier > .\sipVec2Vec2.cpp(150) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(150) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(152) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(152) : error C2227: left of '->y' must point to > class/struct/union/generic type type is ''unknown-type'' > .\sipVec2Vec2.cpp(162) : error C2065: 'Vec2' : undeclared identifier > .\sipVec2Vec2.cpp(162) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(162) : error C2061: syntax error : identifier 'Vec2' > .\sipVec2Vec2.cpp(169) : error C2065: 'sipCpp' : undeclared identifier > .\sipVec2Vec2.cpp(169) : error C2227: left of '->y' must point to > class/struct/union/generic type type is ''unknown-type'' > > > > i know my problem is with the namespace, because without this, all is fine > i can compile and the python test is ok > > could you explain me please, i don't understand why > > thx for your help > > Kermit
You have to put the namespace definition in your .sip file as well. Phil _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
