Dear all,<br><br>I am learning SIP and I made simple source like this:<br><br>//spam.cpp<br><br>#include "spam.h"<br><br>int spam_system(const char *command);<br><br>int main(int argc, char **argv )<br>{<br> spam_system(argv[1]);<br>
return 0;<br>}<br><br>int spam_system(const char *command)<br>{<br> int sts;<br> sts = system(command);<br> return sts;<br>}<br><br><br>spam.h is in the same folder of spam.cpp and containing:<br><br>// spam.h<br>#include <cstdlib><br>
<br>int spam_system(const char *command);<br><br><br>Then I made simple setup.py:<br><br>from distutils.core import setup, Extension<br>import sipdistutils<br><br>setup(<br> name = 'spam',<br> version ='0.1',<br>
ext_modules = [<br> Extension("spam", ["spam.sip", "spam.cpp"])<br> ],<br> cmdclass = {'build_ext': sipdistutils.build_ext}<br> )<br><br>with spam.sip:<br><br>/* Define the SIP wrapper to the spam library. */<br>
<br>%Module spam 0<br><br>%ModuleHeaderCode<br>#include "spam.h"<br>%End<br><br>int spam_system(const char *command);<br><br><br>Then run 'python.exe setup.py build'. But then I got error messages<br><br>
spam.sip(6) : fatal error C1083: Cannot open include file: 'spam.h': No such file or directory<br>error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2<br>
<br>My question: where shall I put spam.h then so sip can compile it successfully? How is the best structure of building python binding with sip? And sorry for the long email.<br><br>-- <br>Mico | <a href="mailto:mico.siahaan@gmail.com">mico.siahaan@gmail.com</a> | @bangmico<br>
<br>