我正在使用arm-linux-androideabi-g++编译器.当我尝试编译一个简单的"你好,世界!" 程序编译好.当我通过在该代码中添加一个简单的异常处理来测试它时它也可以工作(添加之后-fexceptions..我猜它默认是禁用的).
这适用于Android设备,我只想使用CMake,而不是ndk-build.
例如 - first.cpp
#include <iostream>
using namespace std;
int main()
{
try
{
}
catch (...)
{
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
./arm-linux-androideadi-g++ -o first-test first.cpp -fexceptions
它没有问题......
问题 ...我试图用CMake文件编译文件.
我想添加-fexceptions标志.我试过了
set (CMAKE_EXE_LINKER_FLAGS -fexceptions ) or set (CMAKE_EXE_LINKER_FLAGS "fexceptions" )
Run Code Online (Sandbox Code Playgroud)
和
set ( CMAKE_C_FLAGS "fexceptions")
Run Code Online (Sandbox Code Playgroud)
它仍然显示错误.
我正在尝试运行由我的一个朋友创建的Visual Studio cpp项目.我试图在没有VS的情况下运行该文件.但是我得到的错误列表都是以相同的格式:
inlining failed in call to always_inline '__m256d _mm256_broadcast_sd(const double*)': target specific option mismatch|
Run Code Online (Sandbox Code Playgroud)
它在具有释放模式的VS中正确运行,并在调试模式下运行时中断.
该includes为如下:
#include "stdafx.h"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
# include <omp.h>
#include <chrono>
#include <fstream>
#include <algorithm>
#include <immintrin.h>
using namespace std::chrono;
using namespace std;
Run Code Online (Sandbox Code Playgroud)
并从这里调用错误:
double zero = 0;
__m256d acc = _mm256_broadcast_sd(&zero);
Run Code Online (Sandbox Code Playgroud)
更新:
我使用这个命令来运行它:g++ -std=c++0x multip.cpp -o multip是有一个额外的参数来-mavx添加到编译器调用?