美文网首页
g++: pure virtual method called

g++: pure virtual method called

作者: alston_tsao | 来源:发表于2017-02-14 02:16 被阅读0次

This code build successfully but crash at runtime if you compile with gcc/g++ with whatever flags which including -march=armxxx, it will probably crash at runtime at a very high probability.

#include <iostream>
#include <string>
#include <thread>
#include <future>
#include <arm_neon.h>

using namespace std;

void print(string s) { cout << s << endl; }

int main() {
    float32x4_t x;
    auto _ = std::async(std::launch::async, print, "async works");
    thread m(print, "thread works");
    cout << "hi" << endl;
    m.join();
    return 0;
}

The solution on my raspberry pi is do not use -march, instead use-mfloat-abi=hard -mfpu=neon.

References:

相关文章

网友评论

      本文标题:g++: pure virtual method called

      本文链接:https://www.haomeiwen.com/subject/oyxxwttx.html