Integrating C++ (Visual Studio 2009) with python issue

View: New views
15 Messages — Rating Filter:   Alert me  

Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello guys. I am using SWIG for the first time to use a C++ library in pythong project.
To start with, I am trying to build a very simple C++ extension given in following link. Probably most basic example. The example is from the SWIG site SWIG example
I have a windows XP machine. I am using Microsoft Visual Studio 2008 (SP1) for C++ compiler.
Also My setup.py file looks like as below..


from distutils.core import setup, Extension

example_module = Extension('_example',
                                    sources=['example.i'],
                                    swig_opts=[-c++'],
)


setup (name = 'Example',
          version = "0.1",
          description = "SWIG example""",
          ext_modules = [example_module],
          py_modules = ["Example"],
)


When I try to compile using
> python setup.py build.txt

I get quite a few compilation error.

The errors are as follows :

..
..
..
creating build\lib.win32-2.6
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCRE
MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex
ample build\temp.win32-2.6\Release\example_wrap.obj /OUT:build\lib.win32-2.6\_ex
ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib /MANIFESTFILE:build\
temp.win32-2.6\Release\_example.pyd.manifest
   Creating library build\temp.win32-2.6\Release\_example.lib and object build\t
emp.win32-2.6\Release\_example.exp
example_wrap.obj : error LNK2019: unresolved external symbol "double My_variable
" (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl fact(i
nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl my_mod
(int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
example_wrap.obj : error LNK2019: unresolved external symbol "char * __cdecl get
_time(void)" (?get_time@@YAPADXZ) referenced in function __wrap_get_time
build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved externals
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"'
failed with exit status 1120

I tried to google for above but I could not find anything.

Most of the solutions I found are valid for older versions of Visual Studio environment.

I feel there maybe some issue with the new compiler ?

Has anyone worked on Visual Studio 2009 and python?

This seems like a simple problem but I haven't been able to solve it. Please help.

Regards, Alok

Re: Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Something to do with the linker i suppose.. am I missing something?

alok.jadhav wrote:
Hello guys. I am using SWIG for the first time to use a C++ library in pythong project.
To start with, I am trying to build a very simple C++ extension given in following link. Probably most basic example. The example is from the SWIG site SWIG example
I have a windows XP machine. I am using Microsoft Visual Studio 2008 (SP1) for C++ compiler.
Also My setup.py file looks like as below..


from distutils.core import setup, Extension

example_module = Extension('_example',
                                    sources=['example.i'],
                                    swig_opts=[-c++'],
)


setup (name = 'Example',
          version = "0.1",
          description = "SWIG example""",
          ext_modules = [example_module],
          py_modules = ["Example"],
)


When I try to compile using
> python setup.py build.txt

I get quite a few compilation error.

The errors are as follows :

..
..
..
creating build\lib.win32-2.6
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCRE
MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex
ample build\temp.win32-2.6\Release\example_wrap.obj /OUT:build\lib.win32-2.6\_ex
ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib /MANIFESTFILE:build\
temp.win32-2.6\Release\_example.pyd.manifest
   Creating library build\temp.win32-2.6\Release\_example.lib and object build\t
emp.win32-2.6\Release\_example.exp
example_wrap.obj : error LNK2019: unresolved external symbol "double My_variable
" (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl fact(i
nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl my_mod
(int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
example_wrap.obj : error LNK2019: unresolved external symbol "char * __cdecl get
_time(void)" (?get_time@@YAPADXZ) referenced in function __wrap_get_time
build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved externals
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"'
failed with exit status 1120

I tried to google for above but I could not find anything.

Most of the solutions I found are valid for older versions of Visual Studio environment.

I feel there maybe some issue with the new compiler ?

Has anyone worked on Visual Studio 2009 and python?

This seems like a simple problem but I haven't been able to solve it. Please help.

Regards, Alok

Re: Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

sorry for the typos .. :)
It should be Visual Studio 2008 (not 2009) ..and Python*


alok.jadhav wrote:
Hello guys. I am using SWIG for the first time to use a C++ library in pythong project.
To start with, I am trying to build a very simple C++ extension given in following link. Probably most basic example. The example is from the SWIG site SWIG example
I have a windows XP machine. I am using Microsoft Visual Studio 2008 (SP1) for C++ compiler.
Also My setup.py file looks like as below..


from distutils.core import setup, Extension

example_module = Extension('_example',
                                    sources=['example.i'],
                                    swig_opts=[-c++'],
)


setup (name = 'Example',
          version = "0.1",
          description = "SWIG example""",
          ext_modules = [example_module],
          py_modules = ["Example"],
)


When I try to compile using
> python setup.py build.txt

I get quite a few compilation error.

The errors are as follows :

..
..
..
creating build\lib.win32-2.6
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCRE
MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex
ample build\temp.win32-2.6\Release\example_wrap.obj /OUT:build\lib.win32-2.6\_ex
ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib /MANIFESTFILE:build\
temp.win32-2.6\Release\_example.pyd.manifest
   Creating library build\temp.win32-2.6\Release\_example.lib and object build\t
emp.win32-2.6\Release\_example.exp
example_wrap.obj : error LNK2019: unresolved external symbol "double My_variable
" (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl fact(i
nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl my_mod
(int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
example_wrap.obj : error LNK2019: unresolved external symbol "char * __cdecl get
_time(void)" (?get_time@@YAPADXZ) referenced in function __wrap_get_time
build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved externals
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"'
failed with exit status 1120

I tried to google for above but I could not find anything.

Most of the solutions I found are valid for older versions of Visual Studio environment.

I feel there maybe some issue with the new compiler ?

Has anyone worked on Visual Studio 2009 and python?

This seems like a simple problem but I haven't been able to solve it. Please help.

Regards, Alok

Re: Integrating C++ (Visual Studio 2009) with python issue

by David Beazley-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Make sure you include the 'example.c' source file in your  
example_module specification.

However, having said that, I have never once, in the entire time I've  
worked on Swig, ever been able to get Python distutils to properly  
compile any C extension on Windows using any version of Visual  
Studio.  Maybe it's been fixed in some more recent Python  
distributions, but I don't know. On the other hand, I have always been  
able to make working C/C++ extensions by simply creating a proper  
Visual Studio project file that includes the appropriate C source  
files and links against the needed Python libraries.   That's what I  
would recommend doing if you can't get this to work.

Cheers,
Dave


On Oct 16, 2009, at 12:55 AM, alok.jadhav wrote:

>
> Hello guys. I am using SWIG for the first time to use a C++ library in
> pythong project.
> To start with, I am trying to build a very simple C++ extension  
> given in
> following link. Probably most basic example. The example is from the  
> SWIG
> site  http://www.swig.org/tutorial.html SWIG example
> I have a windows XP machine. I am using Microsoft Visual Studio 2008  
> (SP1)
> for C++ compiler.
> Also My setup.py file looks like as below..
>
>
> from distutils.core import setup, Extension
>
> example_module = Extension('_example',
>                                    sources=['example.i'],
>                                    swig_opts=[-c++'],
> )
>
>
> setup (name = 'Example',
>          version = "0.1",
>          description = "SWIG example""",
>          ext_modules = [example_module],
>          py_modules = ["Example"],
> )
>
>
> When I try to compile using
>> python setup.py build.txt
>
> I get quite a few compilation error.
>
> The errors are as follows :
>
> ..
> ..
> ..
> creating build\lib.win32-2.6
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
> nologo
> /INCRE
> MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild
> /EXPORT:init_ex
> ample build\temp.win32-2.6\Release\example_wrap.obj
> /OUT:build\lib.win32-2.6\_ex
> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
> /MANIFESTFILE:build\
> temp.win32-2.6\Release\_example.pyd.manifest
>   Creating library build\temp.win32-2.6\Release\_example.lib and  
> object
> build\t
> emp.win32-2.6\Release\_example.exp
> example_wrap.obj : error LNK2019: unresolved external symbol "double
> My_variable
> " (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
> example_wrap.obj : error LNK2019: unresolved external symbol "int  
> __cdecl
> fact(i
> nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
> example_wrap.obj : error LNK2019: unresolved external symbol "int  
> __cdecl
> my_mod
> (int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
> example_wrap.obj : error LNK2019: unresolved external symbol "char *  
> __cdecl
> get
> _time(void)" (?get_time@@YAPADXZ) referenced in function  
> __wrap_get_time
> build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved
> externals
> error: command '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\link.exe"'
> failed with exit status 1120
>
> I tried to google for above but I could not find anything.
>
> Most of the solutions I found are valid for older versions of Visual  
> Studio
> environment.
>
> I feel there maybe some issue with the new compiler ?
>
> Has anyone worked on Visual Studio 2009 and python?
>
> This seems like a simple problem but I haven't been able to solve  
> it. Please
> help.
>
> Regards, Alok
> --
> View this message in context: http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-with-python-issue-tp25920174p25920174.html
> Sent from the swig-user mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


David,

Thanks for your response. I tried using the Visual Studio approach. There were no compilation errors. Looks fine. But I could not import the module.  

Following was the error when I tried to load the module

>>> import example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "example.py", line 25, in <module>
    _example = swig_import_helper()
  File "example.py", line 17, in swig_import_helper
    import _example
ImportError: No module named _example
>>> import _example
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named _example

I have included __init__.py file in the directory.

I hope this should be very simple to tackle. I do not understand what is wrong here.

Thanks.

Regards, Alok


alok.jadhav wrote:
Hello guys. I am using SWIG for the first time to use a C++ library in pythong project.
To start with, I am trying to build a very simple C++ extension given in following link. Probably most basic example. The example is from the SWIG site SWIG example
I have a windows XP machine. I am using Microsoft Visual Studio 2008 (SP1) for C++ compiler.
Also My setup.py file looks like as below..


from distutils.core import setup, Extension

example_module = Extension('_example',
                                    sources=['example.i'],
                                    swig_opts=[-c++'],
)


setup (name = 'Example',
          version = "0.1",
          description = "SWIG example""",
          ext_modules = [example_module],
          py_modules = ["Example"],
)


When I try to compile using
> python setup.py build.txt

I get quite a few compilation error.

The errors are as follows :

..
..
..
creating build\lib.win32-2.6
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCRE
MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex
ample build\temp.win32-2.6\Release\example_wrap.obj /OUT:build\lib.win32-2.6\_ex
ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib /MANIFESTFILE:build\
temp.win32-2.6\Release\_example.pyd.manifest
   Creating library build\temp.win32-2.6\Release\_example.lib and object build\t
emp.win32-2.6\Release\_example.exp
example_wrap.obj : error LNK2019: unresolved external symbol "double My_variable
" (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl fact(i
nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl my_mod
(int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
example_wrap.obj : error LNK2019: unresolved external symbol "char * __cdecl get
_time(void)" (?get_time@@YAPADXZ) referenced in function __wrap_get_time
build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved externals
error: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"'
failed with exit status 1120

I tried to google for above but I could not find anything.

Most of the solutions I found are valid for older versions of Visual Studio environment.

I feel there maybe some issue with the new compiler ?

Has anyone worked on Visual Studio 2009 and python?

This seems like a simple problem but I haven't been able to solve it. Please help.

Regards, Alok

Re: Integrating C++ (Visual Studio 2009) with python issue

by David Beazley-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Make sure the module DLL has a .pyd file suffix and it's on the Python  
search path (sys.path)

-D

On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:

>
>
> David,
>
> Thanks for your response. I tried using the Visual Studio approach.  
> There
> were no compilation errors. Looks fine. But I could not import the  
> module.
>
> Following was the error when I tried to load the module
>
>>>> import example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "example.py", line 25, in <module>
>    _example = swig_import_helper()
>  File "example.py", line 17, in swig_import_helper
>    import _example
> ImportError: No module named _example
>>>> import _example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named _example
>
> I have included __init__.py file in the directory.
>
> I hope this should be very simple to tackle. I do not understand  
> what is
> wrong here.
>
> Thanks.
>
> Regards, Alok
>
>
>
> alok.jadhav wrote:
>>
>> Hello guys. I am using SWIG for the first time to use a C++ library  
>> in
>> pythong project.
>> To start with, I am trying to build a very simple C++ extension  
>> given in
>> following link. Probably most basic example. The example is from  
>> the SWIG
>> site  http://www.swig.org/tutorial.html SWIG example
>> I have a windows XP machine. I am using Microsoft Visual Studio  
>> 2008 (SP1)
>> for C++ compiler.
>> Also My setup.py file looks like as below..
>>
>>
>> from distutils.core import setup, Extension
>>
>> example_module = Extension('_example',
>>                                    sources=['example.i'],
>>                                    swig_opts=[-c++'],
>> )
>>
>>
>> setup (name = 'Example',
>>          version = "0.1",
>>          description = "SWIG example""",
>>          ext_modules = [example_module],
>>          py_modules = ["Example"],
>> )
>>
>>
>> When I try to compile using
>>> python setup.py build.txt
>>
>> I get quite a few compilation error.
>>
>> The errors are as follows :
>>
>> ..
>> ..
>> ..
>> creating build\lib.win32-2.6
>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>> nologo
>> /INCRE
>> MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild
>> /EXPORT:init_ex
>> ample build\temp.win32-2.6\Release\example_wrap.obj
>> /OUT:build\lib.win32-2.6\_ex
>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>> /MANIFESTFILE:build\
>> temp.win32-2.6\Release\_example.pyd.manifest
>>   Creating library build\temp.win32-2.6\Release\_example.lib and  
>> object
>> build\t
>> emp.win32-2.6\Release\_example.exp
>> example_wrap.obj : error LNK2019: unresolved external symbol "double
>> My_variable
>> " (?My_variable@@3NA) referenced in function  
>> _Swig_var_My_variable_set
>> example_wrap.obj : error LNK2019: unresolved external symbol "int  
>> __cdecl
>> fact(i
>> nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
>> example_wrap.obj : error LNK2019: unresolved external symbol "int  
>> __cdecl
>> my_mod
>> (int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>> example_wrap.obj : error LNK2019: unresolved external symbol "char *
>> __cdecl get
>> _time(void)" (?get_time@@YAPADXZ) referenced in function  
>> __wrap_get_time
>> build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved
>> externals
>> error: command '"C:\Program Files\Microsoft Visual Studio
>> 9.0\VC\BIN\link.exe"'
>> failed with exit status 1120
>>
>> I tried to google for above but I could not find anything.
>>
>> Most of the solutions I found are valid for older versions of Visual
>> Studio environment.
>>
>> I feel there maybe some issue with the new compiler ?
>>
>> Has anyone worked on Visual Studio 2009 and python?
>>
>> This seems like a simple problem but I haven't been able to solve it.
>> Please help.
>>
>> Regards, Alok
>>
>
> --
> View this message in context: http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-with-python-issue-tp25920174p25922418.html
> Sent from the swig-user mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with python issue

by wsfulton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

alok.jadhav wrote:

> Hello guys. I am using SWIG for the first time to use a C++ library in
> pythong project.
> To start with, I am trying to build a very simple C++ extension given in
> following link. Probably most basic example. The example is from the SWIG
> site  http://www.swig.org/tutorial.html SWIG example
> I have a windows XP machine. I am using Microsoft Visual Studio 2008 (SP1)
> for C++ compiler.
> Also My setup.py file looks like as below..
>
>
> from distutils.core import setup, Extension
>
> example_module = Extension('_example',
>                                     sources=['example.i'],
>                                     swig_opts=[-c++'],
> )
>
>
> setup (name = 'Example',
>           version = "0.1",
>           description = "SWIG example""",
>           ext_modules = [example_module],
>           py_modules = ["Example"],
> )
>
>
> When I try to compile using
>> python setup.py build.txt
>
> I get quite a few compilation error.
>
> The errors are as follows :
>
> ..
> ..
> ..
> creating build\lib.win32-2.6
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo
> /INCRE
> MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild
> /EXPORT:init_ex
> ample build\temp.win32-2.6\Release\example_wrap.obj
> /OUT:build\lib.win32-2.6\_ex
> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
> /MANIFESTFILE:build\
> temp.win32-2.6\Release\_example.pyd.manifest
>    Creating library build\temp.win32-2.6\Release\_example.lib and object
> build\t
> emp.win32-2.6\Release\_example.exp
> example_wrap.obj : error LNK2019: unresolved external symbol "double
> My_variable
> " (?My_variable@@3NA) referenced in function _Swig_var_My_variable_set
> example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl
> fact(i
> nt)" (?fact@@YAHH@Z) referenced in function __wrap_fact
> example_wrap.obj : error LNK2019: unresolved external symbol "int __cdecl
> my_mod
> (int,int)" (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
> example_wrap.obj : error LNK2019: unresolved external symbol "char * __cdecl
> get
> _time(void)" (?get_time@@YAPADXZ) referenced in function __wrap_get_time
> build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved
> externals
> error: command '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\link.exe"'
> failed with exit status 1120
>
> I tried to google for above but I could not find anything.
>
> Most of the solutions I found are valid for older versions of Visual Studio
> environment.
>
> I feel there maybe some issue with the new compiler ?
>
> Has anyone worked on Visual Studio 2009 and python?
>
> This seems like a simple problem but I haven't been able to solve it. Please
> help.
>
> Regards, Alok

The Windows documentation explains how to use the example Visual Studio
project files distributed with SWIG and with the minimal of fuss. This
is much easier for getting going.

William

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I followed all the steps but it is still not working for me.
I followed a simple hello world program at following site.. But it still
gives me error.

http://en.wikibooks.org/wiki/Python_Programming/Extending_with_C%2B%2B

It is supposed to work fine but I get error


C:\Project\TickCollector\temp2>python setup.py build
running build
running build_ext
building 'hello' extension
creating build
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
/Ox /MD /W
3 /GS- /DNDEBUG -IC:\Python26\include -IC:\Python26\PC
/Tphellomodule.cpp /Fobui
ld\temp.win32-2.6\Release\hellomodule.obj
hellomodule.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) :
warning C
4530: C++ exception handler used, but unwind semantics are not enabled.
Specify
/EHsc
creating build\lib.win32-2.6
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
/nologo /INCRE
MENTAL:NO /LIBPATH:C:\Python26\libs /LIBPATH:C:\Python26\PCbuild
/EXPORT:inithel
lo build\temp.win32-2.6\Release\hellomodule.obj
/OUT:build\lib.win32-2.6\hello.p
yd /IMPLIB:build\temp.win32-2.6\Release\hello.lib
/MANIFESTFILE:build\temp.win32
-2.6\Release\hello.pyd.manifest
LINK : error LNK2001: unresolved external symbol inithello
build\temp.win32-2.6\Release\hello.lib : fatal error LNK1120: 1
unresolved exter
nals
error: command '"C:\Program Files\Microsoft Visual Studio
9.0\VC\BIN\link.exe"'
failed with exit status 1120

Which is a linker error. Unresolved externals. "LINK : error LNK2001:
unresolved external symbol inithello"

Regards, Alok

 

-----Original Message-----
From: William Fulton [mailto:william@...] On Behalf Of
William S Fulton
Sent: Friday, October 16, 2009 11:00 PM
To: Jadhav, Alok
Cc: swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
python issue

alok.jadhav wrote:
> Hello guys. I am using SWIG for the first time to use a C++ library in

> pythong project.
> To start with, I am trying to build a very simple C++ extension given
> in following link. Probably most basic example. The example is from
> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have a

> windows XP machine. I am using Microsoft Visual Studio 2008 (SP1) for
> C++ compiler.
> Also My setup.py file looks like as below..
>
>
> from distutils.core import setup, Extension
>
> example_module = Extension('_example',
>                                     sources=['example.i'],
>                                     swig_opts=[-c++'],
> )
>
>
> setup (name = 'Example',
>           version = "0.1",
>           description = "SWIG example""",
>           ext_modules = [example_module],
>           py_modules = ["Example"],
> )
>
>
> When I try to compile using
>> python setup.py build.txt
>
> I get quite a few compilation error.
>
> The errors are as follows :
>
> ..
> ..
> ..
> creating build\lib.win32-2.6
> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
> /nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
> build\temp.win32-2.6\Release\example_wrap.obj
> /OUT:build\lib.win32-2.6\_ex
> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
> /MANIFESTFILE:build\
> temp.win32-2.6\Release\_example.pyd.manifest
>    Creating library build\temp.win32-2.6\Release\_example.lib and
> object build\t emp.win32-2.6\Release\_example.exp
> example_wrap.obj : error LNK2019: unresolved external symbol "double
> My_variable " (?My_variable@@3NA) referenced in function
> _Swig_var_My_variable_set example_wrap.obj : error LNK2019: unresolved

> external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z) referenced in

> function __wrap_fact example_wrap.obj : error LNK2019: unresolved
> external symbol "int __cdecl my_mod (int,int)" (?my_mod@@YAHHH@Z)
> referenced in function __wrap_my_mod example_wrap.obj : error LNK2019:

> unresolved external symbol "char * __cdecl get _time(void)"
> (?get_time@@YAPADXZ) referenced in function __wrap_get_time
> build\lib.win32-2.6\_example.pyd : fatal error LNK1120: 4 unresolved
> externals
> error: command '"C:\Program Files\Microsoft Visual Studio
> 9.0\VC\BIN\link.exe"'
> failed with exit status 1120
>
> I tried to google for above but I could not find anything.
>
> Most of the solutions I found are valid for older versions of Visual
> Studio environment.
>
> I feel there maybe some issue with the new compiler ?
>
> Has anyone worked on Visual Studio 2009 and python?
>
> This seems like a simple problem but I haven't been able to solve it.
> Please help.
>
> Regards, Alok

The Windows documentation explains how to use the example Visual Studio
project files distributed with SWIG and with the minimal of fuss. This
is much easier for getting going.

William

===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with python issue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I followed the steps on the site
http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create a
visual studio project to generate a python extension using swig.
 
When I use Visual Studio instead of distustils to compile my c++ file
and to generate py extension, it generates a .py file and not .pyd file.
I use following configuration.

Custom Build Options for Visual Studio

Command Line:  swig -python -o
C:\Project\TickCollector\temp2\hello_wrap.c
C:\Project\TickCollector\temp2\hello.i

Output: C:\Project\TickCollector\temp2\hello_wrap.c


/* hello.i */
%module hello
extern void say_hello(const char* name);


/* hellomodule.cpp */
#include "stdafx.h"
#include <iostream>
 
using namespace std;
 
void say_hello(const char* name) {
    cout << "Hello " <<  name << "!\n";


It generates a .py file without any errors. But I cannot import this
module in Python. (Gets _hello module not found error.)

How do I generate a .pyd extension file using visual studio?


Regards,
Alok

 

-----Original Message-----
From: David Beazley [mailto:dave@...]
Sent: Friday, October 16, 2009 5:24 PM
To: Jadhav, Alok
Cc: David Beazley; swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
python issue

Make sure the module DLL has a .pyd file suffix and it's on the Python
search path (sys.path)

-D

On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:

>
>
> David,
>
> Thanks for your response. I tried using the Visual Studio approach.  
> There
> were no compilation errors. Looks fine. But I could not import the
> module.
>
> Following was the error when I tried to load the module
>
>>>> import example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "example.py", line 25, in <module>
>    _example = swig_import_helper()
>  File "example.py", line 17, in swig_import_helper
>    import _example
> ImportError: No module named _example
>>>> import _example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named _example
>
> I have included __init__.py file in the directory.
>
> I hope this should be very simple to tackle. I do not understand what
> is wrong here.
>
> Thanks.
>
> Regards, Alok
>
>
>
> alok.jadhav wrote:
>>
>> Hello guys. I am using SWIG for the first time to use a C++ library
>> in pythong project.
>> To start with, I am trying to build a very simple C++ extension given

>> in following link. Probably most basic example. The example is from
>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have
>> a windows XP machine. I am using Microsoft Visual Studio
>> 2008 (SP1)
>> for C++ compiler.
>> Also My setup.py file looks like as below..
>>
>>
>> from distutils.core import setup, Extension
>>
>> example_module = Extension('_example',
>>                                    sources=['example.i'],
>>                                    swig_opts=[-c++'],
>> )
>>
>>
>> setup (name = 'Example',
>>          version = "0.1",
>>          description = "SWIG example""",
>>          ext_modules = [example_module],
>>          py_modules = ["Example"],
>> )
>>
>>
>> When I try to compile using
>>> python setup.py build.txt
>>
>> I get quite a few compilation error.
>>
>> The errors are as follows :
>>
>> ..
>> ..
>> ..
>> creating build\lib.win32-2.6
>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>> build\temp.win32-2.6\Release\example_wrap.obj
>> /OUT:build\lib.win32-2.6\_ex
>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>> /MANIFESTFILE:build\
>> temp.win32-2.6\Release\_example.pyd.manifest
>>   Creating library build\temp.win32-2.6\Release\_example.lib and
>> object build\t emp.win32-2.6\Release\_example.exp
>> example_wrap.obj : error LNK2019: unresolved external symbol "double
>> My_variable " (?My_variable@@3NA) referenced in function
>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>> referenced in function __wrap_fact example_wrap.obj : error LNK2019:
>> unresolved external symbol "int __cdecl my_mod (int,int)"
>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>> example_wrap.obj : error LNK2019: unresolved external symbol "char *
>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in function
>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>> LNK1120: 4 unresolved externals
>> error: command '"C:\Program Files\Microsoft Visual Studio
>> 9.0\VC\BIN\link.exe"'
>> failed with exit status 1120
>>
>> I tried to google for above but I could not find anything.
>>
>> Most of the solutions I found are valid for older versions of Visual
>> Studio environment.
>>
>> I feel there maybe some issue with the new compiler ?
>>
>> Has anyone worked on Visual Studio 2009 and python?
>>
>> This seems like a simple problem but I haven't been able to solve it.
>> Please help.
>>
>> Regards, Alok
>>
>
> --
> View this message in context:
> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-wit
> h-python-issue-tp25920174p25922418.html
> Sent from the swig-user mailing list archive at Nabble.com.
>
>
> ----------------------------------------------------------------------
> -------- Come build with us! The BlackBerry(R) Developer Conference in

> SF, CA is the only developer event you need to attend this year.
> Jumpstart your developing skills, take BlackBerry mobile applications
> to market and stay ahead of the curve. Join us from November 9 - 12,
> 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with pythonissue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

 Is there an mIRC chat room where we can get quick replies?
Still waiting for a response on this one.. I haven't been able to solve
this small issue.

-----Original Message-----
From: Jadhav, Alok
Sent: Tuesday, October 20, 2009 12:16 PM
To: David Beazley
Cc: swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
pythonissue


I followed the steps on the site
http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create a
visual studio project to generate a python extension using swig.
 
When I use Visual Studio instead of distustils to compile my c++ file
and to generate py extension, it generates a .py file and not .pyd file.
I use following configuration.

Custom Build Options for Visual Studio

Command Line:  swig -python -o
C:\Project\TickCollector\temp2\hello_wrap.c
C:\Project\TickCollector\temp2\hello.i

Output: C:\Project\TickCollector\temp2\hello_wrap.c


/* hello.i */
%module hello
extern void say_hello(const char* name);


/* hellomodule.cpp */
#include "stdafx.h"
#include <iostream>
 
using namespace std;
 
void say_hello(const char* name) {
    cout << "Hello " <<  name << "!\n";


It generates a .py file without any errors. But I cannot import this
module in Python. (Gets _hello module not found error.)

How do I generate a .pyd extension file using visual studio?


Regards,
Alok

 

-----Original Message-----
From: David Beazley [mailto:dave@...]
Sent: Friday, October 16, 2009 5:24 PM
To: Jadhav, Alok
Cc: David Beazley; swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
python issue

Make sure the module DLL has a .pyd file suffix and it's on the Python
search path (sys.path)

-D

On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:

>
>
> David,
>
> Thanks for your response. I tried using the Visual Studio approach.  
> There
> were no compilation errors. Looks fine. But I could not import the
> module.
>
> Following was the error when I tried to load the module
>
>>>> import example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "example.py", line 25, in <module>
>    _example = swig_import_helper()
>  File "example.py", line 17, in swig_import_helper
>    import _example
> ImportError: No module named _example
>>>> import _example
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> ImportError: No module named _example
>
> I have included __init__.py file in the directory.
>
> I hope this should be very simple to tackle. I do not understand what
> is wrong here.
>
> Thanks.
>
> Regards, Alok
>
>
>
> alok.jadhav wrote:
>>
>> Hello guys. I am using SWIG for the first time to use a C++ library
>> in pythong project.
>> To start with, I am trying to build a very simple C++ extension given

>> in following link. Probably most basic example. The example is from
>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have
>> a windows XP machine. I am using Microsoft Visual Studio
>> 2008 (SP1)
>> for C++ compiler.
>> Also My setup.py file looks like as below..
>>
>>
>> from distutils.core import setup, Extension
>>
>> example_module = Extension('_example',
>>                                    sources=['example.i'],
>>                                    swig_opts=[-c++'],
>> )
>>
>>
>> setup (name = 'Example',
>>          version = "0.1",
>>          description = "SWIG example""",
>>          ext_modules = [example_module],
>>          py_modules = ["Example"],
>> )
>>
>>
>> When I try to compile using
>>> python setup.py build.txt
>>
>> I get quite a few compilation error.
>>
>> The errors are as follows :
>>
>> ..
>> ..
>> ..
>> creating build\lib.win32-2.6
>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>> build\temp.win32-2.6\Release\example_wrap.obj
>> /OUT:build\lib.win32-2.6\_ex
>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>> /MANIFESTFILE:build\
>> temp.win32-2.6\Release\_example.pyd.manifest
>>   Creating library build\temp.win32-2.6\Release\_example.lib and
>> object build\t emp.win32-2.6\Release\_example.exp
>> example_wrap.obj : error LNK2019: unresolved external symbol "double
>> My_variable " (?My_variable@@3NA) referenced in function
>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>> referenced in function __wrap_fact example_wrap.obj : error LNK2019:
>> unresolved external symbol "int __cdecl my_mod (int,int)"
>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>> example_wrap.obj : error LNK2019: unresolved external symbol "char *
>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in function
>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>> LNK1120: 4 unresolved externals
>> error: command '"C:\Program Files\Microsoft Visual Studio
>> 9.0\VC\BIN\link.exe"'
>> failed with exit status 1120
>>
>> I tried to google for above but I could not find anything.
>>
>> Most of the solutions I found are valid for older versions of Visual
>> Studio environment.
>>
>> I feel there maybe some issue with the new compiler ?
>>
>> Has anyone worked on Visual Studio 2009 and python?
>>
>> This seems like a simple problem but I haven't been able to solve it.
>> Please help.
>>
>> Regards, Alok
>>
>
> --
> View this message in context:
> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-wit
> h-python-issue-tp25920174p25922418.html
> Sent from the swig-user mailing list archive at Nabble.com.
>
>
> ----------------------------------------------------------------------
> -------- Come build with us! The BlackBerry(R) Developer Conference in

> SF, CA is the only developer event you need to attend this year.
> Jumpstart your developing skills, take BlackBerry mobile applications
> to market and stay ahead of the curve. Join us from November 9 - 12,
> 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


========================================================================
=======
 Please access the attached hyperlink for an important electronic
communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
 
========================================================================
=======
 

------------------------------------------------------------------------
------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is
the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and
stay ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with pythonissue

by David Beazley-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The .pyd file is the same as the DLL file that's being compiled.    
So, if you're creating a module called 'hello', the SWIG output is  
going to consist of a Python file called "hello.py" and a DLL called  
"_hello.pyd".   To get the .pyd suffix, you need to change the target/
linker settings in Visual Studio.   Just find the configuration page  
that has the name of the output file and change it so that it says  
"_hello.pyd".

-Dave

On Oct 20, 2009, at 9:32 PM, Jadhav, Alok wrote:

> Is there an mIRC chat room where we can get quick replies?
> Still waiting for a response on this one.. I haven't been able to  
> solve
> this small issue.
>
> -----Original Message-----
> From: Jadhav, Alok
> Sent: Tuesday, October 20, 2009 12:16 PM
> To: David Beazley
> Cc: swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> pythonissue
>
>
> I followed the steps on the site
> http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to  
> create a
> visual studio project to generate a python extension using swig.
>
> When I use Visual Studio instead of distustils to compile my c++ file
> and to generate py extension, it generates a .py file and not .pyd  
> file.
> I use following configuration.
>
> Custom Build Options for Visual Studio
>
> Command Line:  swig -python -o
> C:\Project\TickCollector\temp2\hello_wrap.c
> C:\Project\TickCollector\temp2\hello.i
>
> Output: C:\Project\TickCollector\temp2\hello_wrap.c
>
>
> /* hello.i */
> %module hello
> extern void say_hello(const char* name);
>
>
> /* hellomodule.cpp */
> #include "stdafx.h"
> #include <iostream>
>
> using namespace std;
>
> void say_hello(const char* name) {
>    cout << "Hello " <<  name << "!\n";
>
>
> It generates a .py file without any errors. But I cannot import this
> module in Python. (Gets _hello module not found error.)
>
> How do I generate a .pyd extension file using visual studio?
>
>
> Regards,
> Alok
>
>
>
> -----Original Message-----
> From: David Beazley [mailto:dave@...]
> Sent: Friday, October 16, 2009 5:24 PM
> To: Jadhav, Alok
> Cc: David Beazley; swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> python issue
>
> Make sure the module DLL has a .pyd file suffix and it's on the Python
> search path (sys.path)
>
> -D
>
> On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:
>
>>
>>
>> David,
>>
>> Thanks for your response. I tried using the Visual Studio approach.
>> There
>> were no compilation errors. Looks fine. But I could not import the
>> module.
>>
>> Following was the error when I tried to load the module
>>
>>>>> import example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "example.py", line 25, in <module>
>>   _example = swig_import_helper()
>> File "example.py", line 17, in swig_import_helper
>>   import _example
>> ImportError: No module named _example
>>>>> import _example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named _example
>>
>> I have included __init__.py file in the directory.
>>
>> I hope this should be very simple to tackle. I do not understand what
>> is wrong here.
>>
>> Thanks.
>>
>> Regards, Alok
>>
>>
>>
>> alok.jadhav wrote:
>>>
>>> Hello guys. I am using SWIG for the first time to use a C++ library
>>> in pythong project.
>>> To start with, I am trying to build a very simple C++ extension  
>>> given
>
>>> in following link. Probably most basic example. The example is from
>>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have
>>> a windows XP machine. I am using Microsoft Visual Studio
>>> 2008 (SP1)
>>> for C++ compiler.
>>> Also My setup.py file looks like as below..
>>>
>>>
>>> from distutils.core import setup, Extension
>>>
>>> example_module = Extension('_example',
>>>                                   sources=['example.i'],
>>>                                   swig_opts=[-c++'],
>>> )
>>>
>>>
>>> setup (name = 'Example',
>>>         version = "0.1",
>>>         description = "SWIG example""",
>>>         ext_modules = [example_module],
>>>         py_modules = ["Example"],
>>> )
>>>
>>>
>>> When I try to compile using
>>>> python setup.py build.txt
>>>
>>> I get quite a few compilation error.
>>>
>>> The errors are as follows :
>>>
>>> ..
>>> ..
>>> ..
>>> creating build\lib.win32-2.6
>>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>>> build\temp.win32-2.6\Release\example_wrap.obj
>>> /OUT:build\lib.win32-2.6\_ex
>>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>>> /MANIFESTFILE:build\
>>> temp.win32-2.6\Release\_example.pyd.manifest
>>>  Creating library build\temp.win32-2.6\Release\_example.lib and
>>> object build\t emp.win32-2.6\Release\_example.exp
>>> example_wrap.obj : error LNK2019: unresolved external symbol "double
>>> My_variable " (?My_variable@@3NA) referenced in function
>>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>>> referenced in function __wrap_fact example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl my_mod (int,int)"
>>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>>> example_wrap.obj : error LNK2019: unresolved external symbol "char *
>>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in function
>>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>>> LNK1120: 4 unresolved externals
>>> error: command '"C:\Program Files\Microsoft Visual Studio
>>> 9.0\VC\BIN\link.exe"'
>>> failed with exit status 1120
>>>
>>> I tried to google for above but I could not find anything.
>>>
>>> Most of the solutions I found are valid for older versions of Visual
>>> Studio environment.
>>>
>>> I feel there maybe some issue with the new compiler ?
>>>
>>> Has anyone worked on Visual Studio 2009 and python?
>>>
>>> This seems like a simple problem but I haven't been able to solve  
>>> it.
>>> Please help.
>>>
>>> Regards, Alok
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29- 
>> wit
>> h-python-issue-tp25920174p25922418.html
>> Sent from the swig-user mailing list archive at Nabble.com.
>>
>>
>> ----------------------------------------------------------------------
>> -------- Come build with us! The BlackBerry(R) Developer Conference  
>> in
>
>> SF, CA is the only developer event you need to attend this year.
>> Jumpstart your developing skills, take BlackBerry mobile applications
>> to market and stay ahead of the curve. Join us from November 9 - 12,
>> 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
> =
> =
> ======================================================================
> =======
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> =
> =
> ======================================================================
> =======
>
>
> ------------------------------------------------------------------------
> ------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA  
> is
> the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and
> stay ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic  
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with pythonissue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks David.
 
So now I add hello_wrap.cpp to the existing project to compile it with
my hello.cpp to generate a _hello.pyd. (I missed this step earlier while
working with Visual Studio)
But now it is not compiling at all. I get the same error as I was
getting with my distutils (setup.py) script.

hello_wrap.obj : error LNK2001: unresolved external symbol _say_hello
C:\Project\TickCollector\temp2\hello\Release\$_(ProjectName).pyd : fatal
error LNK1120: 1 unresolved externals


Kind of back to square one.

I am just not able to compile my project. (Linking error.) say_hello is
the function that needs to be wrapped. Any function or variable that
needs to be wrapped produces a linking error. Both the files (original
file and the input_wrap.cxx file are in the same folder and part of same
project.) Still the linking error. What is it that I am missing.

I am sure there is some silly mistake that I am doing. I just hope if
you can help me find this mistake.


Thanks,
Alok

-----Original Message-----
From: David Beazley [mailto:dave@...]
Sent: Wednesday, October 21, 2009 2:24 PM
To: Jadhav, Alok
Cc: David Beazley; swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
pythonissue

The .pyd file is the same as the DLL file that's being compiled.    
So, if you're creating a module called 'hello', the SWIG output is going
to consist of a Python file called "hello.py" and a DLL called  
"_hello.pyd".   To get the .pyd suffix, you need to change the target/
linker settings in Visual Studio.   Just find the configuration page  
that has the name of the output file and change it so that it says
"_hello.pyd".

-Dave

On Oct 20, 2009, at 9:32 PM, Jadhav, Alok wrote:

> Is there an mIRC chat room where we can get quick replies?
> Still waiting for a response on this one.. I haven't been able to
> solve this small issue.
>
> -----Original Message-----
> From: Jadhav, Alok
> Sent: Tuesday, October 20, 2009 12:16 PM
> To: David Beazley
> Cc: swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> pythonissue
>
>
> I followed the steps on the site
> http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create
> a visual studio project to generate a python extension using swig.
>
> When I use Visual Studio instead of distustils to compile my c++ file
> and to generate py extension, it generates a .py file and not .pyd
> file.
> I use following configuration.
>
> Custom Build Options for Visual Studio
>
> Command Line:  swig -python -o
> C:\Project\TickCollector\temp2\hello_wrap.c
> C:\Project\TickCollector\temp2\hello.i
>
> Output: C:\Project\TickCollector\temp2\hello_wrap.c
>
>
> /* hello.i */
> %module hello
> extern void say_hello(const char* name);
>
>
> /* hellomodule.cpp */
> #include "stdafx.h"
> #include <iostream>
>
> using namespace std;
>
> void say_hello(const char* name) {
>    cout << "Hello " <<  name << "!\n";
>
>
> It generates a .py file without any errors. But I cannot import this
> module in Python. (Gets _hello module not found error.)
>
> How do I generate a .pyd extension file using visual studio?
>
>
> Regards,
> Alok
>
>
>
> -----Original Message-----
> From: David Beazley [mailto:dave@...]
> Sent: Friday, October 16, 2009 5:24 PM
> To: Jadhav, Alok
> Cc: David Beazley; swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> python issue
>
> Make sure the module DLL has a .pyd file suffix and it's on the Python

> search path (sys.path)
>
> -D
>
> On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:
>
>>
>>
>> David,
>>
>> Thanks for your response. I tried using the Visual Studio approach.
>> There
>> were no compilation errors. Looks fine. But I could not import the
>> module.
>>
>> Following was the error when I tried to load the module
>>
>>>>> import example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "example.py", line 25, in <module>
>>   _example = swig_import_helper()
>> File "example.py", line 17, in swig_import_helper
>>   import _example
>> ImportError: No module named _example
>>>>> import _example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named _example
>>
>> I have included __init__.py file in the directory.
>>
>> I hope this should be very simple to tackle. I do not understand what

>> is wrong here.
>>
>> Thanks.
>>
>> Regards, Alok
>>
>>
>>
>> alok.jadhav wrote:
>>>
>>> Hello guys. I am using SWIG for the first time to use a C++ library
>>> in pythong project.
>>> To start with, I am trying to build a very simple C++ extension
>>> given
>
>>> in following link. Probably most basic example. The example is from
>>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have

>>> a windows XP machine. I am using Microsoft Visual Studio
>>> 2008 (SP1)
>>> for C++ compiler.
>>> Also My setup.py file looks like as below..
>>>
>>>
>>> from distutils.core import setup, Extension
>>>
>>> example_module = Extension('_example',
>>>                                   sources=['example.i'],
>>>                                   swig_opts=[-c++'],
>>> )
>>>
>>>
>>> setup (name = 'Example',
>>>         version = "0.1",
>>>         description = "SWIG example""",
>>>         ext_modules = [example_module],
>>>         py_modules = ["Example"],
>>> )
>>>
>>>
>>> When I try to compile using
>>>> python setup.py build.txt
>>>
>>> I get quite a few compilation error.
>>>
>>> The errors are as follows :
>>>
>>> ..
>>> ..
>>> ..
>>> creating build\lib.win32-2.6
>>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>>> build\temp.win32-2.6\Release\example_wrap.obj
>>> /OUT:build\lib.win32-2.6\_ex
>>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>>> /MANIFESTFILE:build\
>>> temp.win32-2.6\Release\_example.pyd.manifest
>>>  Creating library build\temp.win32-2.6\Release\_example.lib and
>>> object build\t emp.win32-2.6\Release\_example.exp
>>> example_wrap.obj : error LNK2019: unresolved external symbol "double

>>> My_variable " (?My_variable@@3NA) referenced in function
>>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>>> referenced in function __wrap_fact example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl my_mod (int,int)"
>>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>>> example_wrap.obj : error LNK2019: unresolved external symbol "char *

>>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in function

>>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>>> LNK1120: 4 unresolved externals
>>> error: command '"C:\Program Files\Microsoft Visual Studio
>>> 9.0\VC\BIN\link.exe"'
>>> failed with exit status 1120
>>>
>>> I tried to google for above but I could not find anything.
>>>
>>> Most of the solutions I found are valid for older versions of Visual

>>> Studio environment.
>>>
>>> I feel there maybe some issue with the new compiler ?
>>>
>>> Has anyone worked on Visual Studio 2009 and python?
>>>
>>> This seems like a simple problem but I haven't been able to solve
>>> it.
>>> Please help.
>>>
>>> Regards, Alok
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-
>> wit
>> h-python-issue-tp25920174p25922418.html
>> Sent from the swig-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Come build with us! The BlackBerry(R) Developer Conference
>> in
>
>> SF, CA is the only developer event you need to attend this year.
>> Jumpstart your developing skills, take BlackBerry mobile applications

>> to market and stay ahead of the curve. Join us from November 9 - 12,
>> 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
> =
> =
> ======================================================================
> =======
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> =
> =
> ======================================================================
> =======
>
>
>
------------------------------------------------------------------------

> ------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA  
> is
> the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and
> stay ahead of the curve. Join us from November 9 - 12, 2009. Register
> now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic  
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>
>
>
------------------------------------------------------------------------
------

> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart  
> your
> developing skills, take BlackBerry mobile applications to market and  
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) withpythonissue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I got it working. Don't know why I looked at it at the last place.
My hello.i file was incorrect. I did copy it from one of the tutorial
though.  Everything works fine with my new file. Planning to move ahead
in my project now.

Thanks for your support.
AJ

-----Original Message-----
From: Jadhav, Alok
Sent: Wednesday, October 21, 2009 3:24 PM
To: David Beazley
Cc: swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009)
withpythonissue

Thanks David.
 
So now I add hello_wrap.cpp to the existing project to compile it with
my hello.cpp to generate a _hello.pyd. (I missed this step earlier while
working with Visual Studio) But now it is not compiling at all. I get
the same error as I was getting with my distutils (setup.py) script.

hello_wrap.obj : error LNK2001: unresolved external symbol _say_hello
C:\Project\TickCollector\temp2\hello\Release\$_(ProjectName).pyd : fatal
error LNK1120: 1 unresolved externals


Kind of back to square one.

I am just not able to compile my project. (Linking error.) say_hello is
the function that needs to be wrapped. Any function or variable that
needs to be wrapped produces a linking error. Both the files (original
file and the input_wrap.cxx file are in the same folder and part of same
project.) Still the linking error. What is it that I am missing.

I am sure there is some silly mistake that I am doing. I just hope if
you can help me find this mistake.


Thanks,
Alok

-----Original Message-----
From: David Beazley [mailto:dave@...]
Sent: Wednesday, October 21, 2009 2:24 PM
To: Jadhav, Alok
Cc: David Beazley; swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
pythonissue

The .pyd file is the same as the DLL file that's being compiled.    
So, if you're creating a module called 'hello', the SWIG output is going
to consist of a Python file called "hello.py" and a DLL called  
"_hello.pyd".   To get the .pyd suffix, you need to change the target/
linker settings in Visual Studio.   Just find the configuration page  
that has the name of the output file and change it so that it says
"_hello.pyd".

-Dave

On Oct 20, 2009, at 9:32 PM, Jadhav, Alok wrote:

> Is there an mIRC chat room where we can get quick replies?
> Still waiting for a response on this one.. I haven't been able to
> solve this small issue.
>
> -----Original Message-----
> From: Jadhav, Alok
> Sent: Tuesday, October 20, 2009 12:16 PM
> To: David Beazley
> Cc: swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> pythonissue
>
>
> I followed the steps on the site
> http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create
> a visual studio project to generate a python extension using swig.
>
> When I use Visual Studio instead of distustils to compile my c++ file
> and to generate py extension, it generates a .py file and not .pyd
> file.
> I use following configuration.
>
> Custom Build Options for Visual Studio
>
> Command Line:  swig -python -o
> C:\Project\TickCollector\temp2\hello_wrap.c
> C:\Project\TickCollector\temp2\hello.i
>
> Output: C:\Project\TickCollector\temp2\hello_wrap.c
>
>
> /* hello.i */
> %module hello
> extern void say_hello(const char* name);
>
>
> /* hellomodule.cpp */
> #include "stdafx.h"
> #include <iostream>
>
> using namespace std;
>
> void say_hello(const char* name) {
>    cout << "Hello " <<  name << "!\n";
>
>
> It generates a .py file without any errors. But I cannot import this
> module in Python. (Gets _hello module not found error.)
>
> How do I generate a .pyd extension file using visual studio?
>
>
> Regards,
> Alok
>
>
>
> -----Original Message-----
> From: David Beazley [mailto:dave@...]
> Sent: Friday, October 16, 2009 5:24 PM
> To: Jadhav, Alok
> Cc: David Beazley; swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> python issue
>
> Make sure the module DLL has a .pyd file suffix and it's on the Python

> search path (sys.path)
>
> -D
>
> On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:
>
>>
>>
>> David,
>>
>> Thanks for your response. I tried using the Visual Studio approach.
>> There
>> were no compilation errors. Looks fine. But I could not import the
>> module.
>>
>> Following was the error when I tried to load the module
>>
>>>>> import example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "example.py", line 25, in <module>
>>   _example = swig_import_helper()
>> File "example.py", line 17, in swig_import_helper
>>   import _example
>> ImportError: No module named _example
>>>>> import _example
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> ImportError: No module named _example
>>
>> I have included __init__.py file in the directory.
>>
>> I hope this should be very simple to tackle. I do not understand what

>> is wrong here.
>>
>> Thanks.
>>
>> Regards, Alok
>>
>>
>>
>> alok.jadhav wrote:
>>>
>>> Hello guys. I am using SWIG for the first time to use a C++ library
>>> in pythong project.
>>> To start with, I am trying to build a very simple C++ extension
>>> given
>
>>> in following link. Probably most basic example. The example is from
>>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I have

>>> a windows XP machine. I am using Microsoft Visual Studio
>>> 2008 (SP1)
>>> for C++ compiler.
>>> Also My setup.py file looks like as below..
>>>
>>>
>>> from distutils.core import setup, Extension
>>>
>>> example_module = Extension('_example',
>>>                                   sources=['example.i'],
>>>                                   swig_opts=[-c++'],
>>> )
>>>
>>>
>>> setup (name = 'Example',
>>>         version = "0.1",
>>>         description = "SWIG example""",
>>>         ext_modules = [example_module],
>>>         py_modules = ["Example"],
>>> )
>>>
>>>
>>> When I try to compile using
>>>> python setup.py build.txt
>>>
>>> I get quite a few compilation error.
>>>
>>> The errors are as follows :
>>>
>>> ..
>>> ..
>>> ..
>>> creating build\lib.win32-2.6
>>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>>> build\temp.win32-2.6\Release\example_wrap.obj
>>> /OUT:build\lib.win32-2.6\_ex
>>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>>> /MANIFESTFILE:build\
>>> temp.win32-2.6\Release\_example.pyd.manifest
>>>  Creating library build\temp.win32-2.6\Release\_example.lib and
>>> object build\t emp.win32-2.6\Release\_example.exp
>>> example_wrap.obj : error LNK2019: unresolved external symbol "double

>>> My_variable " (?My_variable@@3NA) referenced in function
>>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>>> referenced in function __wrap_fact example_wrap.obj : error LNK2019:
>>> unresolved external symbol "int __cdecl my_mod (int,int)"
>>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>>> example_wrap.obj : error LNK2019: unresolved external symbol "char *

>>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in function

>>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>>> LNK1120: 4 unresolved externals
>>> error: command '"C:\Program Files\Microsoft Visual Studio
>>> 9.0\VC\BIN\link.exe"'
>>> failed with exit status 1120
>>>
>>> I tried to google for above but I could not find anything.
>>>
>>> Most of the solutions I found are valid for older versions of Visual

>>> Studio environment.
>>>
>>> I feel there maybe some issue with the new compiler ?
>>>
>>> Has anyone worked on Visual Studio 2009 and python?
>>>
>>> This seems like a simple problem but I haven't been able to solve
>>> it.
>>> Please help.
>>>
>>> Regards, Alok
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-
>> wit
>> h-python-issue-tp25920174p25922418.html
>> Sent from the swig-user mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> -
>> -------- Come build with us! The BlackBerry(R) Developer Conference
>> in
>
>> SF, CA is the only developer event you need to attend this year.
>> Jumpstart your developing skills, take BlackBerry mobile applications

>> to market and stay ahead of the curve. Join us from November 9 - 12,
>> 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
> =
> =
> ======================================================================
> =======
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>
> =
> =
> ======================================================================
> =======
>
>
>
------------------------------------------------------------------------

> ------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your developing skills, take BlackBerry mobile applications to market
> and stay ahead of the curve. Join us from November 9 - 12, 2009.
> Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>
>
>
------------------------------------------------------------------------
------

> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your developing skills, take BlackBerry mobile applications to market
> and stay ahead of the curve. Join us from November 9 - 12, 2009.
> Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Swig-user mailing list
> Swig-user@...
> https://lists.sourceforge.net/lists/listinfo/swig-user


========================================================================
=======
 Please access the attached hyperlink for an important electronic
communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
 
========================================================================
=======
 

------------------------------------------------------------------------
------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is
the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and
stay ahead of the curve. Join us from November 9 - 12, 2009. Register
now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with pythonissue

by David Beazley-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The error message is pretty self-explanatory.   It says that some  
symbol "say_hello" is missing?  Are you also compiling/linking that  
function?

-Dave

On Oct 21, 2009, at 4:53 AM, Jadhav, Alok wrote:

> Thanks David.
>
> So now I add hello_wrap.cpp to the existing project to compile it with
> my hello.cpp to generate a _hello.pyd. (I missed this step earlier  
> while
> working with Visual Studio)
> But now it is not compiling at all. I get the same error as I was
> getting with my distutils (setup.py) script.
>
> hello_wrap.obj : error LNK2001: unresolved external symbol _say_hello
> C:\Project\TickCollector\temp2\hello\Release\$_(ProjectName).pyd :  
> fatal
> error LNK1120: 1 unresolved externals
>
>
> Kind of back to square one.
>
> I am just not able to compile my project. (Linking error.) say_hello  
> is
> the function that needs to be wrapped. Any function or variable that
> needs to be wrapped produces a linking error. Both the files (original
> file and the input_wrap.cxx file are in the same folder and part of  
> same
> project.) Still the linking error. What is it that I am missing.
>
> I am sure there is some silly mistake that I am doing. I just hope if
> you can help me find this mistake.
>
>
> Thanks,
> Alok
>
> -----Original Message-----
> From: David Beazley [mailto:dave@...]
> Sent: Wednesday, October 21, 2009 2:24 PM
> To: Jadhav, Alok
> Cc: David Beazley; swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> pythonissue
>
> The .pyd file is the same as the DLL file that's being compiled.
> So, if you're creating a module called 'hello', the SWIG output is  
> going
> to consist of a Python file called "hello.py" and a DLL called
> "_hello.pyd".   To get the .pyd suffix, you need to change the target/
> linker settings in Visual Studio.   Just find the configuration page
> that has the name of the output file and change it so that it says
> "_hello.pyd".
>
> -Dave
>
> On Oct 20, 2009, at 9:32 PM, Jadhav, Alok wrote:
>
>> Is there an mIRC chat room where we can get quick replies?
>> Still waiting for a response on this one.. I haven't been able to
>> solve this small issue.
>>
>> -----Original Message-----
>> From: Jadhav, Alok
>> Sent: Tuesday, October 20, 2009 12:16 PM
>> To: David Beazley
>> Cc: swig-user@...
>> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
>> pythonissue
>>
>>
>> I followed the steps on the site
>> http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create
>> a visual studio project to generate a python extension using swig.
>>
>> When I use Visual Studio instead of distustils to compile my c++ file
>> and to generate py extension, it generates a .py file and not .pyd
>> file.
>> I use following configuration.
>>
>> Custom Build Options for Visual Studio
>>
>> Command Line:  swig -python -o
>> C:\Project\TickCollector\temp2\hello_wrap.c
>> C:\Project\TickCollector\temp2\hello.i
>>
>> Output: C:\Project\TickCollector\temp2\hello_wrap.c
>>
>>
>> /* hello.i */
>> %module hello
>> extern void say_hello(const char* name);
>>
>>
>> /* hellomodule.cpp */
>> #include "stdafx.h"
>> #include <iostream>
>>
>> using namespace std;
>>
>> void say_hello(const char* name) {
>>   cout << "Hello " <<  name << "!\n";
>>
>>
>> It generates a .py file without any errors. But I cannot import this
>> module in Python. (Gets _hello module not found error.)
>>
>> How do I generate a .pyd extension file using visual studio?
>>
>>
>> Regards,
>> Alok
>>
>>
>>
>> -----Original Message-----
>> From: David Beazley [mailto:dave@...]
>> Sent: Friday, October 16, 2009 5:24 PM
>> To: Jadhav, Alok
>> Cc: David Beazley; swig-user@...
>> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
>> python issue
>>
>> Make sure the module DLL has a .pyd file suffix and it's on the  
>> Python
>
>> search path (sys.path)
>>
>> -D
>>
>> On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:
>>
>>>
>>>
>>> David,
>>>
>>> Thanks for your response. I tried using the Visual Studio approach.
>>> There
>>> were no compilation errors. Looks fine. But I could not import the
>>> module.
>>>
>>> Following was the error when I tried to load the module
>>>
>>>>>> import example
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "example.py", line 25, in <module>
>>>  _example = swig_import_helper()
>>> File "example.py", line 17, in swig_import_helper
>>>  import _example
>>> ImportError: No module named _example
>>>>>> import _example
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> ImportError: No module named _example
>>>
>>> I have included __init__.py file in the directory.
>>>
>>> I hope this should be very simple to tackle. I do not understand  
>>> what
>
>>> is wrong here.
>>>
>>> Thanks.
>>>
>>> Regards, Alok
>>>
>>>
>>>
>>> alok.jadhav wrote:
>>>>
>>>> Hello guys. I am using SWIG for the first time to use a C++ library
>>>> in pythong project.
>>>> To start with, I am trying to build a very simple C++ extension
>>>> given
>>
>>>> in following link. Probably most basic example. The example is from
>>>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I  
>>>> have
>
>>>> a windows XP machine. I am using Microsoft Visual Studio
>>>> 2008 (SP1)
>>>> for C++ compiler.
>>>> Also My setup.py file looks like as below..
>>>>
>>>>
>>>> from distutils.core import setup, Extension
>>>>
>>>> example_module = Extension('_example',
>>>>                                  sources=['example.i'],
>>>>                                  swig_opts=[-c++'],
>>>> )
>>>>
>>>>
>>>> setup (name = 'Example',
>>>>        version = "0.1",
>>>>        description = "SWIG example""",
>>>>        ext_modules = [example_module],
>>>>        py_modules = ["Example"],
>>>> )
>>>>
>>>>
>>>> When I try to compile using
>>>>> python setup.py build.txt
>>>>
>>>> I get quite a few compilation error.
>>>>
>>>> The errors are as follows :
>>>>
>>>> ..
>>>> ..
>>>> ..
>>>> creating build\lib.win32-2.6
>>>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /
>>>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>>>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>>>> build\temp.win32-2.6\Release\example_wrap.obj
>>>> /OUT:build\lib.win32-2.6\_ex
>>>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>>>> /MANIFESTFILE:build\
>>>> temp.win32-2.6\Release\_example.pyd.manifest
>>>> Creating library build\temp.win32-2.6\Release\_example.lib and
>>>> object build\t emp.win32-2.6\Release\_example.exp
>>>> example_wrap.obj : error LNK2019: unresolved external symbol  
>>>> "double
>
>>>> My_variable " (?My_variable@@3NA) referenced in function
>>>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>>>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)
>>>> referenced in function __wrap_fact example_wrap.obj : error  
>>>> LNK2019:
>>>> unresolved external symbol "int __cdecl my_mod (int,int)"
>>>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>>>> example_wrap.obj : error LNK2019: unresolved external symbol  
>>>> "char *
>
>>>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in  
>>>> function
>
>>>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>>>> LNK1120: 4 unresolved externals
>>>> error: command '"C:\Program Files\Microsoft Visual Studio
>>>> 9.0\VC\BIN\link.exe"'
>>>> failed with exit status 1120
>>>>
>>>> I tried to google for above but I could not find anything.
>>>>
>>>> Most of the solutions I found are valid for older versions of  
>>>> Visual
>
>>>> Studio environment.
>>>>
>>>> I feel there maybe some issue with the new compiler ?
>>>>
>>>> Has anyone worked on Visual Studio 2009 and python?
>>>>
>>>> This seems like a simple problem but I haven't been able to solve
>>>> it.
>>>> Please help.
>>>>
>>>> Regards, Alok
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-
>>> wit
>>> h-python-issue-tp25920174p25922418.html
>>> Sent from the swig-user mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> -
>>> -------- Come build with us! The BlackBerry(R) Developer Conference
>>> in
>>
>>> SF, CA is the only developer event you need to attend this year.
>>> Jumpstart your developing skills, take BlackBerry mobile  
>>> applications
>
>>> to market and stay ahead of the curve. Join us from November 9 - 12,
>>> 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Swig-user mailing list
>>> Swig-user@...
>>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
>>
>> =
>> =
>> =
>> =====================================================================
>> =======
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>>
>> =
>> =
>> =
>> =====================================================================
>> =======
>>
>>
>>
> ------------------------------------------------------------------------
>> ------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is
>> the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and
>> stay ahead of the curve. Join us from November 9 - 12, 2009. Register
>> now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>>
>>
>>
> ------------------------------------------------------------------------
> ------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your
>> developing skills, take BlackBerry mobile applications to market and
>> stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic  
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Integrating C++ (Visual Studio 2009) with pythonissue

by alok.jadhav :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I was definitely linking everything correctly.
But since my hello.i file was incorrect I guess my hello_wrap.cpp file
was not generated as it was supposed to. (Picked up the hello.i file
from the site directly).
Now after modifying hello.i , it looks good.

-----Original Message-----
From: David Beazley [mailto:dave@...]
Sent: Wednesday, October 21, 2009 3:57 PM
To: Jadhav, Alok
Cc: David Beazley; swig-user@...
Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
pythonissue

The error message is pretty self-explanatory.   It says that some  
symbol "say_hello" is missing?  Are you also compiling/linking that
function?

-Dave

On Oct 21, 2009, at 4:53 AM, Jadhav, Alok wrote:

> Thanks David.
>
> So now I add hello_wrap.cpp to the existing project to compile it with

> my hello.cpp to generate a _hello.pyd. (I missed this step earlier
> while working with Visual Studio) But now it is not compiling at all.
> I get the same error as I was getting with my distutils (setup.py)
> script.
>
> hello_wrap.obj : error LNK2001: unresolved external symbol _say_hello
> C:\Project\TickCollector\temp2\hello\Release\$_(ProjectName).pyd :
> fatal
> error LNK1120: 1 unresolved externals
>
>
> Kind of back to square one.
>
> I am just not able to compile my project. (Linking error.) say_hello
> is the function that needs to be wrapped. Any function or variable
> that needs to be wrapped produces a linking error. Both the files
> (original file and the input_wrap.cxx file are in the same folder and
> part of same
> project.) Still the linking error. What is it that I am missing.
>
> I am sure there is some silly mistake that I am doing. I just hope if
> you can help me find this mistake.
>
>
> Thanks,
> Alok
>
> -----Original Message-----
> From: David Beazley [mailto:dave@...]
> Sent: Wednesday, October 21, 2009 2:24 PM
> To: Jadhav, Alok
> Cc: David Beazley; swig-user@...
> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
> pythonissue
>
> The .pyd file is the same as the DLL file that's being compiled.
> So, if you're creating a module called 'hello', the SWIG output is
> going to consist of a Python file called "hello.py" and a DLL called
> "_hello.pyd".   To get the .pyd suffix, you need to change the target/
> linker settings in Visual Studio.   Just find the configuration page
> that has the name of the output file and change it so that it says
> "_hello.pyd".
>
> -Dave
>
> On Oct 20, 2009, at 9:32 PM, Jadhav, Alok wrote:
>
>> Is there an mIRC chat room where we can get quick replies?
>> Still waiting for a response on this one.. I haven't been able to
>> solve this small issue.
>>
>> -----Original Message-----
>> From: Jadhav, Alok
>> Sent: Tuesday, October 20, 2009 12:16 PM
>> To: David Beazley
>> Cc: swig-user@...
>> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
>> pythonissue
>>
>>
>> I followed the steps on the site
>> http://www.dabeaz.com/cgi-bin/wiki.pl?SwigFaqDLLForWindows  to create

>> a visual studio project to generate a python extension using swig.
>>
>> When I use Visual Studio instead of distustils to compile my c++ file

>> and to generate py extension, it generates a .py file and not .pyd
>> file.
>> I use following configuration.
>>
>> Custom Build Options for Visual Studio
>>
>> Command Line:  swig -python -o
>> C:\Project\TickCollector\temp2\hello_wrap.c
>> C:\Project\TickCollector\temp2\hello.i
>>
>> Output: C:\Project\TickCollector\temp2\hello_wrap.c
>>
>>
>> /* hello.i */
>> %module hello
>> extern void say_hello(const char* name);
>>
>>
>> /* hellomodule.cpp */
>> #include "stdafx.h"
>> #include <iostream>
>>
>> using namespace std;
>>
>> void say_hello(const char* name) {
>>   cout << "Hello " <<  name << "!\n";
>>
>>
>> It generates a .py file without any errors. But I cannot import this
>> module in Python. (Gets _hello module not found error.)
>>
>> How do I generate a .pyd extension file using visual studio?
>>
>>
>> Regards,
>> Alok
>>
>>
>>
>> -----Original Message-----
>> From: David Beazley [mailto:dave@...]
>> Sent: Friday, October 16, 2009 5:24 PM
>> To: Jadhav, Alok
>> Cc: David Beazley; swig-user@...
>> Subject: Re: [Swig-user] Integrating C++ (Visual Studio 2009) with
>> python issue
>>
>> Make sure the module DLL has a .pyd file suffix and it's on the
>> Python
>
>> search path (sys.path)
>>
>> -D
>>
>> On Oct 16, 2009, at 4:29 AM, alok.jadhav wrote:
>>
>>>
>>>
>>> David,
>>>
>>> Thanks for your response. I tried using the Visual Studio approach.
>>> There
>>> were no compilation errors. Looks fine. But I could not import the
>>> module.
>>>
>>> Following was the error when I tried to load the module
>>>
>>>>>> import example
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> File "example.py", line 25, in <module>  _example =
>>> swig_import_helper() File "example.py", line 17, in
>>> swig_import_helper  import _example
>>> ImportError: No module named _example
>>>>>> import _example
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in <module>
>>> ImportError: No module named _example
>>>
>>> I have included __init__.py file in the directory.
>>>
>>> I hope this should be very simple to tackle. I do not understand
>>> what
>
>>> is wrong here.
>>>
>>> Thanks.
>>>
>>> Regards, Alok
>>>
>>>
>>>
>>> alok.jadhav wrote:
>>>>
>>>> Hello guys. I am using SWIG for the first time to use a C++ library

>>>> in pythong project.
>>>> To start with, I am trying to build a very simple C++ extension
>>>> given
>>
>>>> in following link. Probably most basic example. The example is from

>>>> the SWIG site  http://www.swig.org/tutorial.html SWIG example I
>>>> have
>
>>>> a windows XP machine. I am using Microsoft Visual Studio
>>>> 2008 (SP1)
>>>> for C++ compiler.
>>>> Also My setup.py file looks like as below..
>>>>
>>>>
>>>> from distutils.core import setup, Extension
>>>>
>>>> example_module = Extension('_example',
>>>>                                  sources=['example.i'],
>>>>                                  swig_opts=[-c++'],
>>>> )
>>>>
>>>>
>>>> setup (name = 'Example',
>>>>        version = "0.1",
>>>>        description = "SWIG example""",
>>>>        ext_modules = [example_module],
>>>>        py_modules = ["Example"],
>>>> )
>>>>
>>>>
>>>> When I try to compile using
>>>>> python setup.py build.txt
>>>>
>>>> I get quite a few compilation error.
>>>>
>>>> The errors are as follows :
>>>>
>>>> ..
>>>> ..
>>>> ..
>>>> creating build\lib.win32-2.6
>>>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /

>>>> nologo /INCRE MENTAL:NO /LIBPATH:C:\Python26\libs
>>>> /LIBPATH:C:\Python26\PCbuild /EXPORT:init_ex ample
>>>> build\temp.win32-2.6\Release\example_wrap.obj
>>>> /OUT:build\lib.win32-2.6\_ex
>>>> ample.pyd /IMPLIB:build\temp.win32-2.6\Release\_example.lib
>>>> /MANIFESTFILE:build\
>>>> temp.win32-2.6\Release\_example.pyd.manifest
>>>> Creating library build\temp.win32-2.6\Release\_example.lib and
>>>> object build\t emp.win32-2.6\Release\_example.exp
>>>> example_wrap.obj : error LNK2019: unresolved external symbol
>>>> "double
>
>>>> My_variable " (?My_variable@@3NA) referenced in function
>>>> _Swig_var_My_variable_set example_wrap.obj : error LNK2019:
>>>> unresolved external symbol "int __cdecl fact(i nt)" (?fact@@YAHH@Z)

>>>> referenced in function __wrap_fact example_wrap.obj : error
>>>> LNK2019:
>>>> unresolved external symbol "int __cdecl my_mod (int,int)"
>>>> (?my_mod@@YAHHH@Z) referenced in function __wrap_my_mod
>>>> example_wrap.obj : error LNK2019: unresolved external symbol "char
>>>> *
>
>>>> __cdecl get _time(void)" (?get_time@@YAPADXZ) referenced in
>>>> function
>
>>>> __wrap_get_time build\lib.win32-2.6\_example.pyd : fatal error
>>>> LNK1120: 4 unresolved externals
>>>> error: command '"C:\Program Files\Microsoft Visual Studio
>>>> 9.0\VC\BIN\link.exe"'
>>>> failed with exit status 1120
>>>>
>>>> I tried to google for above but I could not find anything.
>>>>
>>>> Most of the solutions I found are valid for older versions of
>>>> Visual
>
>>>> Studio environment.
>>>>
>>>> I feel there maybe some issue with the new compiler ?
>>>>
>>>> Has anyone worked on Visual Studio 2009 and python?
>>>>
>>>> This seems like a simple problem but I haven't been able to solve
>>>> it.
>>>> Please help.
>>>>
>>>> Regards, Alok
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Integrating-C%2B%2B-%28Visual-Studio-2009%29-
>>> wit
>>> h-python-issue-tp25920174p25922418.html
>>> Sent from the swig-user mailing list archive at Nabble.com.
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> -
>>> -------- Come build with us! The BlackBerry(R) Developer Conference
>>> in
>>
>>> SF, CA is the only developer event you need to attend this year.
>>> Jumpstart your developing skills, take BlackBerry mobile
>>> applications
>
>>> to market and stay ahead of the curve. Join us from November 9 - 12,

>>> 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Swig-user mailing list
>>> Swig-user@...
>>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
>>
>> =
>> =
>> =
>> =====================================================================
>> =======
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>>
>> =
>> =
>> =
>> =====================================================================
>> =======
>>
>>
>>
> ----------------------------------------------------------------------
> --
>> ------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your developing skills, take BlackBerry mobile applications to market

>> and stay ahead of the curve. Join us from November 9 - 12, 2009.
>> Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> Please access the attached hyperlink for an important electronic
>> communications disclaimer:
>> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>>
>>
>>
> ----------------------------------------------------------------------
> --
> ------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart
>> your developing skills, take BlackBerry mobile applications to market

>> and stay ahead of the curve. Join us from November 9 - 12, 2009.
>> Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user@...
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> Please access the attached hyperlink for an important electronic
> communications disclaimer:
> http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
> =
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
>


===============================================================================
 Please access the attached hyperlink for an important electronic communications disclaimer:
 http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html 
 ===============================================================================
 

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user