小编HAO*_*LEE的帖子

无法构建 boost python 库(致命错误:pyconfig.h:没有这样的文件或目录)

我正在尝试在我的 ubuntu 上构建 boost python 库。但是,当我执行

./b2 --with-python
Run Code Online (Sandbox Code Playgroud)

它总是返回与我相关的错误

./boost/python/detail/wrap_python.hpp:57:11: fatal error: pyconfig.h: No such file or directory
 # include <pyconfig.h>
           ^~~~~~~~~~~~
Run Code Online (Sandbox Code Playgroud)

我尝试在线查找,例如https://github.com/boostorg/build/issues/289

按照他们的建议,我检查了我的“project-config.jam”,我发现

# Python configuration
import python ;
if ! [ python.configured ]
{
    using python : 3.7 : /home/lowlimb/anaconda3 :/home/lowlimb/anaconda3/include/python3.7m;
}

Run Code Online (Sandbox Code Playgroud)

这是正确的,因此我真的不知道如何解决这个问题。有人可以给我一些建议吗?

c++ python ubuntu boost boost-python

7
推荐指数
3
解决办法
1万
查看次数

Boost序列化仅在main中起作用?当我在其他对象中使用时,一直说“没有名为'serialize'的成员”

我目前正在使用c ++ boost库从实时控制系统(OS:Linux)中保存一些数据。我要保存的数据是通过以下方式定义的对象:

#ifndef RECDATA_HPP
#define RECDATA_HPP
#include <vector>
template<class T>
class RecData
{
private:
    std::vector<std::vector<T>> data;
    std::vector<unsigned long> time;
    // Allow serialization to access non-public data members.
    friend class boost::serialization::access;
    // Implement serialize method
    template <class Archive>
    void serialize(Archive &ar, const unsigned int version)
    {
        ar & data;
        ar & time;
    } 


public:
    std::vector<std::vector<T>> getData(){
        return this->data;
    }
    std::vector<unsigned long> getTime(){
        return this->time;
    }
    void PushData(std::vector<T> inData);
    void PushTime(unsigned long curTime);
};
template<class T>
void RecData<T>::PushData(std::vector<T> inData){
    this->data.push_back(inData);
} …
Run Code Online (Sandbox Code Playgroud)

c++ serialization boost c++11

2
推荐指数
1
解决办法
107
查看次数

注意:'std :: thread'在头文件'&lt;thread&gt;'中定义;您忘记了“ #include &lt;thread&gt;”吗?

我尝试在c ++中编译一个简单的c ++代码,但是当我尝试在Windows中使用g ++编译它时,总是返回错误。

我用

g++ -std=c++0x -pthread main.cpp
Run Code Online (Sandbox Code Playgroud)

错误消息是:

std::thread' is defined in header '<thread>'; did you forget to '#include <thread>'?
Run Code Online (Sandbox Code Playgroud)

这没有意义,因为代码只是

#include<thread>

void f(int i) {}

int main() {
        std::thread t(f, 1);
        t.join();
        return 0;
}
Run Code Online (Sandbox Code Playgroud)

我相信这段代码可以在linux上运行,我想知道为什么它不能在Windows下运行。

c++ multithreading g++ c++11

0
推荐指数
1
解决办法
288
查看次数

标签 统计

c++ ×3

boost ×2

c++11 ×2

boost-python ×1

g++ ×1

multithreading ×1

python ×1

serialization ×1

ubuntu ×1