User forums > Using Code::Blocks
[MinGW]libboost_python-mgw34-mt-d-1_39.lib is not being linked.
PJani:
Hy im having trouble linking boost python .lib library file in codeblocks. I get undefinited references error, i have the same error with other .lib files. All libraries were build with mingw.
I was working on other projects and i had the same problems with all .lib files not just from boost.
Is this problem of a mingw(not being able to link .lib) or with .lib libraries?
stahta01:
It is most likely user error; note, without the error message you can not get much help. And, this is most likely NOT the correct forum to get help anyways.
The problem is an MinGW linker issue and most likely not really related to Code::Blocks except that you have not added the correct library or added it in the wrong order or place.
Tim S
PJani:
Sory i totaly forgot to add error messages...
--- Quote ---obj\Debug\main.o||In function `main': |
C:\Documents and Settings\PJani\Desktop\SandBox\test_boost_py\main.cpp|14|undefined reference to `_imp___ZN5boost6python6importENS0_3strE'|
C:\Documents and Settings\PJani\Desktop\SandBox\test_boost_py\main.cpp|20|undefined reference to `_imp___ZN5boost6python4execENS0_3strENS0_3api6objectES3_'|
obj\Debug\main.o||In function `ZN5boost6python3api9slice_nilD1Ev': |
)]+0x14)||undefined reference to `_imp___ZN5boost6python6detail8str_baseC2EPKc'|
)]+0x1c)||undefined reference to `_imp___ZN5boost6python3api7getattrERKNS1_6objectEPKc'|
||=== Build finished: 4 errors, 0 warnings ===|
--- End quote ---
And this the code
--- Code: ---#include <boost/python.hpp>
#include <iostream>
using namespace std;
namespace python = boost::python;
int main(){
Py_Initialize();
python::object l;
python::object main_module = python::import("__main__");
python::object main_namespace = main_module.attr("__dict__");
python::object ignored = python::exec("hello = file('hello.txt', 'w')\n"
"hello.write('Hello world!')\n"
"hello.close()",
main_namespace);
return 0;
}
--- End code ---
PJani:
And this library was added by absolute path to codeblocks. Boost was build with mingw.
stahta01:
--- Quote from: PJani on July 04, 2009, 01:04:06 pm ---And this library was added by absolute path to codeblocks. Boost was build with mingw.
--- End quote ---
Please turn on Full Compiler Logging per
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
And, post the Build Log to help me decide where error is.
Note: The Code::Blocks IDE does not always work well with absolute path to library.
It is better to put the path to Library in Linker search directory and the Library name in link library list.
But, this might be an Compiler Setup issue.
I am not sure how to set the Compiler up to use Boost Libraries.
And, http://wiki.codeblocks.org/index.php?title=BoostWindowsQuickRef does not do it the way I think is correct; but, I have never used Boost Libraries before.
Tim S
Note to Self:
Added following line to user-config.jam because my Python is in folder C:\Apps\Python26
--- Code: ---using python : 2.6 : C:\\Apps\\Python26 ;
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version