473,320 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Boost.Python linker errors

kiseitai2
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_python-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

✓ answered by kiseitai2

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.

1 2520
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
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...
0
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> ...
4
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: ...
1
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...
4
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. ...
0
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...
0
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...
0
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...
2
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.