Question

I'm using the Boost libraries in MicroSoft Visual Studios 2012 for a C++ program that is going to have Python embedded into it. The problem is when I try to Build Solution [F7]; I get this ::

Error 1 error LNK1104: cannot open file 'python33.lib' C:\Users\usr\Documents\Visual Studio 2012\Projects\ConsoleApplication1\ConsoleApplication1\LINK

The problem is, I have no idea what this is, means, or any clue of how to fix it. I have already tried to move my python folder into my Desktop, as it was originally in the C:\, I thought maybe it was a permissions error, but that didn't do anything.

Here is my code from a tutorial that I was reading in preparation for the porject::

// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <boost/lambda/lambda.hpp>
#include <boost/python.hpp>

using namespace boost::python;

int main( int argc, char ** argv ) {
  try {
    Py_Initialize();

    object main_module((
      handle<>(borrowed(PyImport_AddModule("__main__")))));

    object main_namespace = main_module.attr("__dict__");

    handle<> ignored(( PyRun_String( "print \"Hello, World\"",
                                     Py_file_input,
                                     main_namespace.ptr(),
                                     main_namespace.ptr() ) ));
  } catch( error_already_set ) {
    PyErr_Print();
  }
}

--Visual Studios 2012 --Windows 7 x64 --Python 3.3.2 --Boost libraries --Python Embedded C++ program

--Link to tutorial page:: http://wiki.python.org/moin/boost.python/EmbeddingPython

Était-ce utile?

La solution

Thanks for all the help David.

For anyone else who runs into this problem, here's what you need to do.

Right click on the Project name (ConsoleApplication1, ect) and under C/C++ general insure that your additional include directories include youe python include, Lib, and libs folders. As well as the boost root and the boost lib(32/64) folder.

Under the linker menu, in the input sub catagory, for additional dependencies, you'll need to add this into there.

C:\Python33\libs\python33.lib
C:\boost_1_54\lib32-msvc-11.0\boost_python-vc110-mt-gd-1_54.lib

Or whatever your install directory is. As well as any other required files. Once that's done your project should build.

Once you're ready to run it you'll need to copy whatever .dll files are needed into the folder where the executable is built.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top