codeapp
codeapp copied to clipboard
无法使用C++ STL库
头文件包含 <vector> 链接时会报错
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main() {
cout << "Hello World!";
cout << 1 + 2 << endl;
cout << floor(7/3) << endl;
vector<int> nums;
nums.push_back(1);
cout << nums[0] << endl;
return 0;
}
报错如下 wasm-ld: error: undefined symbol: __cxa_allocate_exception wasm-ld: error: undefined symbol: __cxa_throw clang++: error: linker command failed with exit code 1 (use -v to see invocation) wasm: file a.out not found
使用远程的Clang和GCC都是可以编译的,但是本地的Clang不行
clang++ main.cpp -fno-exceptions
clang++ main.cpp -fno-exceptions
感谢!已经成功解决。想问一下在哪里修改运行执行的终端命令呢?