[Pyrex] visual studio c/cpp problem

Alexander Belchenko bialix at ukr.net
Thu May 28 11:20:14 CEST 2009


horace пишет:
> hello,
> 
> i try to wrap a c library.
> 
> when trying to compile with setup.py, the visual studio compiler always 
> gives me hundreds of those error messages: "error C2059: syntax error : 
> 'string'"
> 
> i did some experiments with a manually created visual studio project and 
> figured out that compiling works if i rename the generated .c file to 
> .cpp. i guess the pure c compiling mode of visual studio is a bit touchy 
> about the files of the library i want to wrap?
> 
> is there a way (some setup.py setting?) to cause pyrex/cython to create 
> .cpp files instead of .c files? or can the c++ mode of visual studio be 
> forced somehow?

C:\MyPyrexProject> python setup.py build_ext -h
Common commands: (see '--help-commands' for more)

   setup.py build      will build the package underneath 'build/'
   setup.py install    will install the package

Global options:
   --verbose (-v)  run verbosely (default)
   --quiet (-q)    run quietly (turns verbosity off)
   --dry-run (-n)  don't actually do anything
   --help (-h)     show detailed help message

Options for 'build_ext' command:
   --build-lib (-b)        directory for compiled extension modules
   --build-temp (-t)       directory for temporary files (build by-products)
   --inplace (-i)          ignore build-lib and put compiled extensions into
                           the source directory alongside your pure Python
                           modules
   --include-dirs (-I)     list of directories to search for header files
                           (separated by ';')
   --define (-D)           C preprocessor macros to define
   --undef (-U)            C preprocessor macros to undefine
   --libraries (-l)        external C libraries to link with
   --library-dirs (-L)     directories to search for external C libraries
                           (separated by ';')
   --rpath (-R)            directories to search for shared C libraries at
                           runtime
   --link-objects (-O)     extra explicit link objects to include in the 
link
   --debug (-g)            compile/link with debugging information
   --force (-f)            forcibly build everything (ignore file 
timestamps)
   --compiler (-c)         specify the compiler type
   --swig-cpp              make SWIG create C++ files (default is C)
   --swig-opts             list of SWIG command line options
   --swig                  path to the SWIG executable
   --pyrex-cplus           generate C++ source files
   --pyrex-create-listing  write errors to a listing file
   --pyrex-include-dirs    path to the Pyrex include files (separated by 
';')
   --pyrex-c-in-temp       put generated C files in temp directory
   --pyrex-gen-pxi         generate .pxi file for public declarations
   --help-compiler         list available compilers

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
    or: setup.py --help [cmd1 cmd2 ...]
    or: setup.py --help-commands
    or: setup.py cmd --help




More information about the Pyrex mailing list