Note that there are some explanatory texts on larger screens.

plurals
  1. POVisual Studio 8 and Boost.Python library strange linking
    primarykey
    data
    text
    <p>I'm new to VS 8 and C++ in Windows in general. I'm having a strange issue when I attempt to compile a Python extension in VC 8 in two different projects (one was a very simple dummy test project and the other is a fairly large project which I want to add extensions to).</p> <p>I provide the same include/library directories required for Boost.Python to both projects. They are as follows:</p> <p>Include Directories:</p> <ul> <li>C:\boost-python\boost_1_46_1</li> <li>C:\Python27\include</li> </ul> <p>Library Directories:</p> <ul> <li>C:\boost-python\boost_1_46_1\stage\lib</li> <li>C:\Python27\libs</li> </ul> <p>The dummy project compiles and works without issue, the other project seems to be missing a specific library. VS 8 gives the following error message:</p> <pre><code>Error 3 fatal error LNK1104: cannot open file 'libboost_python-vc80-mt-gdp-1_46_1.lib' </code></pre> <p>'libboost_python-vc80-mt-gdp-1_46_1.lib' was not made when I built the boost libraries. </p> <p>I remember the dummy project complained about missing 'libboost_python-vc80-mt-gd-1_46_1.lib' when I did not include the 'C:\boost-python\boost_1_46_1\stage\lib'. But after I supplied that library directory, it compiled without issue. 'libboost_python-vc80-mt-gd-1_46_1.lib' does exist in that directory.</p> <p>So the I'm confused why my other project is looking for gdp instead of gd like my dummy project. The python specific portion of the code is the same in both projects.</p> <p>This was the dummy code I was testing:</p> <pre><code>#include &lt;boost/python.hpp&gt; #include &lt;boost/random.hpp&gt; #include &lt;boost/random/normal_distribution.hpp&gt; using namespace boost::python; boost::mt19937 gen; struct World { std::string msg; double mypi; World(std::string msg): msg(msg) { gen.seed(std::time(0)); } // added constructor void set(std::string msg) { this-&gt;msg = msg; } std::string greet() { return msg; } double get() const { return mypi; } void setter(double mypi) { this-&gt;mypi = mypi; } double getgaussrand() { boost::normal_distribution&lt;&gt; nd(0.0, 1.0); boost::variate_generator&lt;boost::mt19937&amp;, boost::normal_distribution&lt;&gt; &gt; var_nor(gen, nd); return var_nor(); } }; BOOST_PYTHON_MODULE(test_vs_proj_dll) { class_&lt;World&gt;("World", init&lt;std::string&gt;()) .def("greet", &amp;World::greet) .def("set", &amp;World::set) .def("getgaussrand", &amp;World::getgaussrand) .def_readonly("msg", &amp;World::msg) .def_readwrite("mypi", &amp;World::mypi) .add_property("rovalue", &amp;World::get) .add_property("value", &amp;World::get, &amp;World::setter) ; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload