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
- Build started on: 18-07-2013 at 22:17.12
- Build ended on: 18-07-2013 at 22:17.20
- -------------- Build: default in Eureka (compiler: GNU GCC Compiler)---------------
- 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
- C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\main.cpp:71:4: warning: "/*" within comment [-Wcomment]
- In file included from C:\boost_1_54_0/boost/python/object/make_instance.hpp:9:0,
- from C:\boost_1_54_0/boost/python/object/make_ptr_instance.hpp:8,
- from C:\boost_1_54_0/boost/python/to_python_indirect.hpp:11,
- from C:\boost_1_54_0/boost/python/converter/arg_to_python.hpp:10,
- from C:\boost_1_54_0/boost/python/call.hpp:15,
- from C:\boost_1_54_0/boost/python/object_core.hpp:14,
- from C:\boost_1_54_0/boost/python/args.hpp:25,
- from C:\boost_1_54_0/boost\python.hpp:11,
- from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\conversion.h:4,
- from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\data_base.h:6,
- from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\physics.h:3,
- from C:\Users\HOMEDIR\Documents\DevCB\Engine_Eureka\main.cpp:6:
- C:\boost_1_54_0/boost/python/object/instance.hpp:14:36: warning: type attributes ignored after type is already defined [-Wattributes]
- 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
- obj\pywrap.o: In function `ZN6PywrapC2EPKc':
- C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:23: undefined reference to `_imp___ZN5boost6python6importENS0_3strE'
- obj\pywrap.o: In function `ZN6Pywrap13exec_FullFileEv':
- C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:48: undefined reference to `_imp___ZN5boost6python6importENS0_3strE'
- C:/Users/HOMEDIR/Documents/DevCB/Engine_Eureka/pywrap.cpp:50: undefined reference to `_imp___ZN5boost6python9exec_fileENS0_3strENS0_3api6objectES3_'
- obj\pywrap.o: In function `ZN5boost6python9converter13arg_to_pythonIcEC1ERKc':
- C:/boost_1_54_0/boost/python/converter/builtin_converters.hpp:160: undefined reference to `_imp___ZN5boost6python9converter19do_return_to_pythonEc'
- obj\pywrap.o: In function `ZN5boost6python3api24const_attribute_policies3getERKNS1_6objectEPKc':
- C:/boost_1_54_0/boost/python/object_attributes.hpp:74: undefined reference to `_imp___ZN5boost6python3api7getattrERKNS1_6objectEPKc'
- obj\pywrap.o: In function `ZN5boost6python3api19const_item_policies3getERKNS1_6objectES5_':
- C:/boost_1_54_0/boost/python/object_items.hpp:68: undefined reference to `_imp___ZN5boost6python3api7getitemERKNS1_6objectES4_'
- obj\pywrap.o: In function `ZN5boost6python3lenERKNS0_3api6objectE':
- C:/boost_1_54_0/boost/python/object.hpp:21: undefined reference to `_imp___ZN5boost6python23throw_error_already_setEv'
- obj\pywrap.o: In function `ZN5boost6python4listC1Ev':
- C:/boost_1_54_0/boost/python/list.hpp:61: undefined reference to `_imp___ZN5boost6python6detail9list_baseC2Ev'
- obj\pywrap.o: In function `ZN5boost6python3strC1EPKc':
- C:/boost_1_54_0/boost/python/str.hpp:150: undefined reference to `_imp___ZN5boost6python6detail8str_baseC2EPKc'
- obj\pywrap.o: In function `ZN5boost6python15expect_non_nullI7_objectEEPT_S4_':
- C:/boost_1_54_0/boost/python/errors.hpp:45: undefined reference to `_imp___ZN5boost6python23throw_error_already_setEv'
- obj\pywrap.o: In function `ZN5boost6python4list6appendIiEEvRKT_':
- C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
- obj\pywrap.o: In function `ZN5boost6python4list6appendISsEEvRKT_':
- C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
- obj\pywrap.o: In function `ZN5boost6python4list6appendIcEEvRKT_':
- C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
- obj\pywrap.o: In function `ZN5boost6python4list6appendIdEEvRKT_':
- C:/boost_1_54_0/boost/python/list.hpp:72: undefined reference to `_imp___ZN5boost6python6detail9list_base6appendERKNS0_3api6objectE'
- obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIiEC2EP7_object':
- C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
- obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIiEclEv':
- 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'
- obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIcEC2EP7_object':
- C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
- obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIcEclEv':
- 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'
- obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueISsEC2EP7_object':
- C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
- obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueISsEclEv':
- 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'
- obj\pywrap.o: In function `ZN5boost6python9converter14extract_rvalueIdEC2EP7_object':
- C:/boost_1_54_0/boost/python/extract.hpp:166: undefined reference to `_imp___ZN5boost6python9converter25rvalue_from_python_stage1EP7_objectRKNS1_12registrationE'
- obj\pywrap.o: In function `ZNK5boost6python9converter14extract_rvalueIdEclEv':
- 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'
- obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKiEERKNS1_12registrationEPFRT_vE':
- C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
- obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKcEERKNS1_12registrationEPFRT_vE':
- C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
- obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKSsEERKNS1_12registrationEPFRT_vE':
- C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
- obj\pywrap.o: In function `ZN5boost6python9converter6detail16registry_lookup2IVKdEERKNS1_12registrationEPFRT_vE':
- C:/boost_1_54_0/boost/python/converter/registered.hpp:87: undefined reference to `_imp___ZN5boost6python9converter8registry6lookupENS0_9type_infoE'
- collect2.exe: error: ld returned 1 exit status
- Process terminated with status 1 (0 minutes, 8 seconds)
- 26 errors, 2 warnings (0 minutes, 8 seconds)
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.