[PyQt] Basic SIP

zhang jian zhangmdev at gmail.com
Thu Sep 16 18:11:42 BST 2010


Hi,

I am a beginner as well. May be helpful to check my step-by-step note about
the hello SIP tst:

http://cid-a6597afda81373ba.spaces.live.com/blog/cns!A6597AFDA81373BA!1260.entry

It is on Mac though, but I think it should work on Windows, just need to set
the VC projects.

zhang

On Thu, Sep 16, 2010 at 4:50 PM, Mico Siahaan <mico.siahaan at gmail.com>wrote:

> Dear all,
>
> I am learning SIP and I made simple source like this:
>
> //spam.cpp
>
> #include "spam.h"
>
> int spam_system(const char *command);
>
> int main(int argc, char **argv )
> {
> spam_system(argv[1]);
> return 0;
> }
>
> int spam_system(const char *command)
> {
> int sts;
> sts = system(command);
> return sts;
> }
>
>
> spam.h is in the same folder of spam.cpp and containing:
>
> // spam.h
> #include <cstdlib>
>
> int spam_system(const char *command);
>
>
> Then I made simple setup.py:
>
> from distutils.core import setup, Extension
> import sipdistutils
>
> setup(
>   name = 'spam',
>   version ='0.1',
>   ext_modules = [
>     Extension("spam", ["spam.sip", "spam.cpp"])
>     ],
>   cmdclass = {'build_ext': sipdistutils.build_ext}
>  )
>
> with spam.sip:
>
> /* Define the SIP wrapper to the spam library. */
>
> %Module spam 0
>
> %ModuleHeaderCode
> #include "spam.h"
> %End
>
> int spam_system(const char *command);
>
>
> Then run 'python.exe setup.py build'. But then I got error messages
>
> spam.sip(6) : fatal error C1083: Cannot open include file: 'spam.h': No
> such file or directory
> error: command '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\cl.exe"' failed with exit status 2
>
> 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.
>
> --
> Mico | mico.siahaan at gmail.com | @bangmico
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100917/951b8fa7/attachment-0005.html>


More information about the PyQt mailing list