473,698 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Boost.Python linker errors

kiseitai2
93 New Member
Hello everyone,

I recently came across the Boost libraries and thought it would help me simplify my Python wrapper class (takes care of the embedding side). I spent 2 days trying to get the Boost libraries to compile under the MinGW toolset that came with Code::Blocks 12.11. The compilation was finally successful, but now my project can't compile. My project starts to throw "undefined reference to" linker errors when I attempt to use boost::python's functions (it doesn't if I'm simply declaring boost::python:: object objname). I'm using Boost 1.54.0, Win Vista, Python 2.7.5, and MinGW 4.7. Below is my compiler log:
Expand|Select|Wrap|Line Numbers
  1. Build started on: 18-07-2013 at 22:17.12
  2. Build ended on: 18-07-2013 at 22:17.20
  3. -------------- Build: default in Eureka (compiler: GNU GCC Compiler)---------------
  4. mingw32-g++.exe -Wall -I"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Dev. libs\SDL-1.2.15\include\SDL" -I"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Dev. libs\SDL_mixer-1.2.12\include" -I"C:\Program Files\CodeBlocks\MinGW\include" -IC:\boost_1_54_0 -I"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Engine_Eureka\libPywrap" -Ic:\Python27\include -c C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\main.cpp -o obj\main.o
  5. C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\main.cpp:71:4: warning: "/*" within comment [-Wcomment]
  6. In file included from C:\boost_1_54_0/boost/python/object/make_instance.hpp:9:0,
  7. from C:\boost_1_54_0/boost/python/object/make_ptr_instance.hpp:8,
  8. from C:\boost_1_54_0/boost/python/to_python_indirect.hpp:11,
  9. from C:\boost_1_54_0/boost/python/converter/arg_to_python.hpp:10,
  10. from C:\boost_1_54_0/boost/python/call.hpp:15,
  11. from C:\boost_1_54_0/boost/python/object_core.hpp:14,
  12. from C:\boost_1_54_0/boost/python/args.hpp:25,
  13. from C:\boost_1_54_0/boost\python.hpp:11,
  14. from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\conversion.h:4,
  15. from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\data_base.h:6,
  16. from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\physics.h:3,
  17. from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\main.cpp:6:
  18. C:\boost_1_54_0/boost/python/object/instance.hpp:14:36: warning: type attributes ignored after type is already defined [-Wattributes]
  19. mingw32-g++.exe -L"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Dev. libs\SDL-1.2.15\lib" -L"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Dev. libs\SDL_mixer-1.2.12\lib\x86" -L"C:\Program Files\CodeBlocks\MinGW\lib" -LC:\boost_1_54_0\stage\lib -L"C:\Users\HOMEDIR\Documents\Dev-Cpp Projects\Engine_Eureka\libPywrap" -Lc:\Python27\libs -o bin\Eureka.exe obj\conversion.o obj\data_base.o obj\main.o obj\physics.o obj\pywrap.o -lmingw32 -lSDLmain -lSDL.dll -lSDL_mixer -lboost_python-mgw47-mt-s-1_54 -lpython27
  20. obj\pywrap.o: In function `ZN6PywrapC2EPKc':
  21. C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:23: undefined reference to `_imp___ZN5boost6python6importENS0_3strE'
  22. obj\pywrap.o: In function `ZN6Pywrap13exec_FullFileEv':
  23. C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:48: undefined reference to `_imp___ZN5boost6python6importENS0_3strE'
  24. C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:50: undefined reference to `_imp___ZN5boost6python9exec_fileENS0_3strENS0_3api6objectES3_'
  25. obj\pywrap.o: In function `ZN5boost6python9converter13arg_to_pythonIcEC1ERKc':
  26. C:/boost_1_54_0/boost/python/converter/builtin_converters.hpp:160: undefined reference to `_imp___ZN5boost6python9converter19do_return_to_pythonEc'
  27. obj\pywrap.o: In function `ZN5boost6python3api24const_attribute_policies3getERKNS1_6objectEPKc':
  28. C:/boost_1_54_0/boost/python/object_attributes.hpp:74: undefined reference to `_imp___ZN5boost6python3api7getattrERKNS1_6objectEPKc'
  29. obj\pywrap.o: In function `ZN5boost6python3api19const_item_policies3getERKNS1_6objectES5_':
  30. C:/boost_1_54_0/boost/python/object_items.hpp:68: undefined reference to `_imp___ZN5boost6python3api7getitemERKNS1_6objectES4_'
  31. obj\pywrap.o: In function `ZN5boost6python3lenERKNS0_3api6objectE':
  32. C:/boost_1_54_0/boost/python/object.hpp:21: undefined reference to `_imp___ZN5boost6python23throw_error_already_setEv'
  33. obj\pywrap.o: In function `ZN5boost6python4listC1Ev':
  34. C:/boost_1_54_0/boost/python/list.hpp:61: undefined reference to `_imp___ZN5boost6python6detail9list_baseC2Ev'
  35. obj\pywrap.o: In function `ZN5boost6python3strC1EPKc':
  36. C:/boost_1_54_0/boost/python/str.hpp:150: undefined reference to `_imp___ZN5boost6python6detail8str_baseC2EPKc'
  37. obj\pywrap.o: In function `ZN5boost6python15expect_non_nullI7_objectEEPT_S4_':
  38. C:/boost_1_54_0/boost/python/errors.hpp:45: undefined reference to `_imp___ZN5boost6python23throw_error_already_setEv'
  39. obj\pywrap.o: In function `ZN5boost6python4list6appendIiEEvRKT_':
  40. C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
  41. obj\pywrap.o: In function `ZN5boost6python4list6appendISsEEvRKT_':
  42. C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
  43. obj\pywrap.o: In function `ZN5boost6python4list6appendIcEEvRKT_':
  44. C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
  45. obj\pywrap.o: In function `ZN5boost6python4list6appendIdEEvRKT_':
  46. C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
  47. obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIiEC2EP7_object':
  48. C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
  49. obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIiEclEv':
  50. C:/boost_1_54_0/boost/python/extract.hpp:186: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage2EP7_objectRNS1_30rvalue_from_python_stage1_dataERKNS1_12registrationE'
  51. obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIcEC2EP7_object':
  52. C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
  53. obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIcEclEv':
  54. C:/boost_1_54_0/boost/python/extract.hpp:186: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage2EP7_objectRNS1_30rvalue_from_python_stage1_dataERKNS1_12registrationE'
  55. obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueISsEC2EP7_object':
  56. C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
  57. obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueISsEclEv':
  58. C:/boost_1_54_0/boost/python/extract.hpp:186: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage2EP7_objectRNS1_30rvalue_from_python_stage1_dataERKNS1_12registrationE'
  59. obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIdEC2EP7_object':
  60. C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
  61. obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIdEclEv':
  62. C:/boost_1_54_0/boost/python/extract.hpp:186: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage2EP7_objectRNS1_30rvalue_from_python_stage1_dataERKNS1_12registrationE'
  63. obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKiEERKNS1_12registrationEPFRT_vE':
  64. C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
  65. obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKcEERKNS1_12registrationEPFRT_vE':
  66. C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
  67. obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKSsEERKNS1_12registrationEPFRT_vE':
  68. C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
  69. obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKdEERKNS1_12registrationEPFRT_vE':
  70. C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
  71. collect2.exe: error: ld returned 1 exit status
  72. Process terminated with status 1 (0 minutes, 8 seconds)
  73. 26 errors, 2 warnings (0 minutes, 8 seconds)
*Note: I changed the name of the user directory to HOMEDIR

I am lost on what to do as I have added all of the search paths needed to find the libraries and includes. I double checked that libraries weren't duplicated in the compilation process. I also attempted to compile by duplicating the -llibboost_pytho n-etc.a to see what it would do and I got the same errors. I have linked to Python with no issues. I even attempted to build the project with BJam instead, but bjam says "...found 2 targets..." and quits. As a result, I don't know if the project could actually work via BJam. I have spent a minimum of a day looking through forums and attempting all sorts of ideas in old posts. I found two questions on this forum, but they were unanswered. I hope someone wih experience in Boost could point to some silly mistake I made. Thank you for yor time and help.
Jul 19 '13 #1
1 2542
kiseitai2
93 New Member
I feel bad for not updating this thread and closing it. Throughout the year since I posted the question, I decided to add the interpreted using my understanding of the Python documentation. Thus, I dropped my usage of boost altogether and relied on SWIG to create the Python-side hooks. I have not tested the SWIG generated modules, but my integration of the interpreter seems to work on simple test cases. I am closing this old question as soon as I figure out how.
Apr 7 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1215
by: Gouda Man | last post by:
I'm planning to write a large program that will have advanced scripting in python in which the scripter will subclass c++ objects to add functionality. this leads me to boost.python (if you dont already know about boost.python dont bother reading farther cause its a kind of a technical question) anyways i embeded python in a litte c++ test app i wrote and got it working fine. eg: i could write a little python program and my app would load...
0
2126
by: Li Daobing | last post by:
I can't use .def(str(self)) I write a simple example, without `str', I can build it well, but with this one, I can't build //Rational.cpp #include <boost/python.hpp> #include <iostream> using namespace std; using namespace boost::python;
4
2270
by: JDJMSon | last post by:
I was wondering if someone here could help me with a problem I'm having building Python extensions with the Boost.Python library. Basically, if I have a wrapper class with something like this: string TestFunc() { return "Hello World"; } BOOST_PYTHON_MODULE(TestClass)
1
2493
by: Max Wilson | last post by:
Hi, Has anyone here built Boost.Python modules under MinGW? I'm trying to build the Boost.Python tutorial under MinGW and getting an error that says it depends on MSVC, which puzzles me because Boost built using g++. Here's some of my output: Student@YGGDRASIL /c/Boost/libs/python/example/tutorial $ bjam -sTOOLS=mingw -d+2 ....found 1508 targets...
4
4235
by: Shawn McGrath | last post by:
Hi, I'm trying to expose a C++ class' internals to python via boost::python. I can do integer/boolean functions fine, but as soon as I do a string get/set it craps out. boost::python::class_<Entity, std::auto_ptr<pyEntity("Entity") //publics .def("isActive", &Entity::isActive) //bool .def("activate", &Entity::activate) //bool .def("deactivate", &Entity::deactivate) //bool //...
0
1530
by: MarkE | last post by:
I'm just getting started on Boost Python and may have missed this obvious looking problem somewhere. Given a c-extension "testext" written using Boost Python containing a base class "Base", a derived class "Derived", and a function "doSomething" which expects a "Derived" parameter, if I pass it a "Base" parameter an exception is thrown. This is a Boost.Python.ArgumentError. My question is how do I catch this error ? I tried the...
0
1553
by: Ling | last post by:
I am using boost.python to wrap C++ function which includes directmusic libraries to simply play the midi, but lots of linkage errors "error LNK2001: unresolved external symbol". I wonder if it is possible to work with DirectX - directmusic libs. Are there any ways to wrap it? *********************compilation errors ************************* msvc.link.dll bin\msvc-7.1\debug\threading-multi\playmusic.pyd bin \msvc-7.1\debu...
0
4607
by: devito | last post by:
hi there, for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file like the following: // --- snip -------------------------------------------------------------------------------------- @echo off SETLOCAL
2
2424
by: Markus Dehmann | last post by:
What to do if an external library is header-files-only (but you have to use it), and you get lots of linker errors? You will necessarily get linker errors "multiple definition of ..." if you try to separate interface from implementation in your own code. The external-library symbols will first be defined in one .o file and then again in the next one that includes the same implementation-heavy header. Is there any way to avoid the...
0
1276
by: Stodge | last post by:
I'm having issues with Boost Python, downloaded via http://www.boostpro.com. I *think* it's related to WinXP side by side assemblies. My application that uses Boost Python fails to start. I ran dependancy walker on the Boost Python DLL and I get the following: Error: The Side-by-Side configuration information for "c:\data\excds \test adaptation\BOOST_PYTHON-VC80-MT-1_35.DLL" contains errors. This application has failed to start...
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.