[C++-sig] compile some code with boost.python by mingw in win7-64bit

simon zhang hapopen at gmail.com
Fri Jan 4 16:26:44 CET 2013


sorry.I just have a holiday and forget to reply to this message.
I have solved this problem.
This is a problem about compiled in the 64bit system and seted up included
library.

2012/12/31 Blair Hall <blairdhall at gmail.com>

> The comments here may be helpful
>
> http://ctrl-dev.com/2012/02/compiling-boost-python-with-mingw
>
> I would try to get the example working first without the IDE (ie
> follow the boost.python documentation), because boost needs to build
> libraries (unless you downloaded them pre-built). The IDE just makes
> an already complicated problem more complicated.
>
> NOTE
>
> 1: that the boost examples do not seem to work 100% as described in
> the documentation. I have found that, with mingw, the necessary
> libraries do get built, but you need to make sure they are available
> when running the program (e.g., the boost build process for the
> examples tries to test things after they have bgeen built, but this
> fails because the libraries cannot be located at run time). On the
> contrary, using msvc9 things seem to work much better.
>
> 2: the boost embedding example does not seem to work (either with
> mingw or msvc). There are references to this problem already from
> other people.
>
> On Mon, Dec 31, 2012 at 1:27 AM, simon zhang <hapopen at gmail.com> wrote:
> >
> > I decided to make my program compatible with windows environment.But I
> > have very little programming experience on windows.There are some errors
> > need help.
> >
> > Environment:
> >
> > os: win7-64bit,
> > ide: codeblocks12.11,
> > python: Python 2.7.3 Windows X86-64 Installer (Windows AMD64 / Intel 64 /
> > X86-64 binary [1] -- does not include source)
> > compiler: mingw that come from codeblocks installation package.
> > boost: boost1.52
> >
> > I only copy and test this "hello" code that come from
> > ".\boost_1_52_0\libs\python\example\tutorial"
> >
> > Code:
> >
> > #include <iostream>
> > #include <boost/python/module.hpp>
> > #include <boost/python/def.hpp>
> >
> > char const* greet()
> > { return "hello, world"; }
> >
> > BOOST_PYTHON_MODULE(hello_ext)
> > {
> >     using namespace boost::python;
> >     def("greet", greet);
> > }
> >
> > using namespace std;
> > int main()
> > {
> >     cout << "Hello world!" << endl;
> >     return 0;
> > }
> >
> > Error info:
> >
> > mingw32-g++.exe -Wall -fexceptions  -g  -ID:\boost\include\boost-1_52
> > -IC:\Python27\include  -c E:\project\snail-MW\test1\main.cpp -o
> > obj\Debug\main.o
> > mingw32-g++.exe -LD:\boost\lib\ -LC:\Python27\libs  -o
> bin\Debug\test1.exe
> > obj\Debug\main.o   -static
> > obj\Debug\main.o: In function `inithello_ext':
> > E:/project/snail-MW/test1/main.cpp:11: undefined reference to
> > `boost::python::detail::init_module(char const*, void (*)())'
> > obj\Debug\main.o: In function `ZNK5boost6python9type_info4nameEv':
> > D:/boost/include/boost-1_52/boost/python/type_id.hpp:165: undefined
> > reference to `boost::python::detail::gcc_demangle(char const*)'
> > obj\Debug\main.o: In function
> > `ZNK5boost6python15to_python_valueIRKPKcEclES5_':
> >
> >
> D:/boost/include/boost-1_52/boost/python/converter/builtin_converters.hpp:161:
> > undefined reference to
> `boost::python::converter::do_return_to_python(char
> > const*)'
> > ................
> >
> > It have also do some errors that only compile by the command of "bjam
> > toolset=gcc variant=release " in the station
> > ".\boost_1_52_0\libs\python\example\tutorial".
> >
> > _______________________________________________
> > Cplusplus-sig mailing list
> > Cplusplus-sig at python.org
> > http://mail.python.org/mailman/listinfo/cplusplus-sig
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20130104/b988ff64/attachment.html>


More information about the Cplusplus-sig mailing list