0

After following this page on how to install boost in Visual Studio 2022, I added the hello world for Boost.Python into the main.cpp file. However, even though the program builds and runs successfully, I can't find the hello_ext.dll file that can be imported into Python. I've tried searching in the windows file explorer for ANY dll file in my solution directory, but nothing comes up. I've checked the default output directory (i.e. SOLUTION/x64/debug) and it's not there. Did I miss a step?

#define BOOST_PYTHON_STATIC_LIB 

#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

#include <boost/python/module.hpp>
#include <boost/python/def.hpp>

char const* greet()
{
    return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " ");
}
3
  • 4
    If you intend to build a shared library, what's that main() doing there? Are you sure you're not building it as an executable? Commented Aug 1, 2024 at 16:18
  • The main function was left in from the tutorial I followed. Regardless, do I have to specify that I'm building a dll in Visual Studio 2022? If so, how do I do that? I'm not too familiar with the compilation and linking process in C++ so forgive my ignorance. Commented Aug 1, 2024 at 16:27
  • 1
    Indeed, but I don't recall the exact steps (have been using CMake to generate my solutions for way too long). I think in Project context menu (in the solution explorer), you do Properties->Generic, and then select the appropriate Configuration Type. Or just start a new project and select the correct type, that might be easier. Commented Aug 1, 2024 at 16:50

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.