最近,我将我的Windows应用程序转换为Linux C++应用程序,并使用带有Debian的c++子系统交叉编译到Linux。但是,我通过使用json库得到了以下错误
no match for 'operator-' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<double> >::value_type {aka double}' and 'nlohmann::basic_json<>::value_type {aka nlohmann::
Visual Studio代码中的问题控制台向我显示以下向上消息:
#include errors detected. Please update your includePath. InteliSense features for this translation unit
cannot open source file "omp.h"
即使在我找到omp.h的路径后,仍然显示此消息:
find /usr -name omp.h
我的c_cpp_properties.json文件:
{
"configurations": [
{
我知道它在strcmp上失败了。我在下面提供了operator<,它调用strcmp。
在第1行,有一个值@0xbfffeaac。@是什么意思?
#0 0x00212bd8 in strcmp () from /lib/libc.so.6
#1 0x0012ed2f in Json::Value::CZString::operator< (this=0x8317300, other=@0xbfffeeac)
at src/lib_json/json_value.cpp:221
#2 0x001361b0 in std::less<Json::Value::CZS
我正在尝试使用以下配置构建json-c:
./configure --target=arm-linux-androideabi --host=arm-linux-androideabi \
--build=x86_64-unknown-linux-gnu
但我得到了以下错误:
cc1: error: command line option '-std=c++11' is valid for C++/ObjC++ but not for C [-Werror]
我尝试将--disable-std-c++11和--disable-std-cpp11添加到配置
我尝试用"g++ -std=c++11 -o w w.cpp“编译下面的程序,得到错误”cc1plus: error: unrecognized command line option "-std=c++11“”。已尝试使用g++ -Dstd=c++11 -o w w.cpp进行编译,并获得以下错误集:
In file included from /usr/lib/gcc/i686-redhat-linux/4.4.7/../../../../include/c++/4.4.7/iosfwd:41,
from /usr/lib/gcc/i686
我目前正在使用Ubuntu,并试图通过visual studio (代码)启动一个c++文件。文件本身的代码非常简单(只是一个hello world程序):
#include<iostream>
using namespace std;
int main()
{
cout << "Hello cd World!";
return 0;
}
当仅通过按f5键启动代码时,它会显示文件引号:"is missing or invalid“。它将我链接到launch.json文件,该文件告诉我更改路径。这样做之后,它会告诉我同样的事情:“
temp_holder.clear();
temp_holder << n;
n_str = temp_holder.str();
int f = count(n_str.begin(), n_str.end(), a);
这是我的代码,这是g++输出:
In file included from /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/algorithm:63:0,
from trintatres.cpp:5:
/usr/l
最近,我无意中遇到了“在此范围内未声明”的多次错误,如下所示:
/usr/include/c++/9/ext/string_conversions.h:84:25: error: ‘ERANGE’ was not declared in this scope
84 | else if (errno == ERANGE
| ^~~~~~
In file included from /usr/include/c++/9/system_error:39,
from /usr/include
我正在写一个工具来解析C家族的源代码项目,基本上遵循ubuntu12.04上的这两个教程 on clang3.4(主干192426)。
基于,它说我可以通过-p传递compile_commands.json,但是,如果我只输入$ ./main -p [path of compile_commands.json],它会抱怨缺少位置参数。似乎我仍然需要将所有文件名作为参数传递,如果项目真的很大,这是不切实际的。我更喜欢它可以简单地解析compile_commands.json中指定的所有文件,而不需要询问,但无法找到如何打开它。
因为我找不到的教程来做任何定制的事情,所以我改用类。有一个虚拟访问
我已经成功地编译了clang当前的3.3分支。但是,任何文件的C++编译都会失败,并显示错误/错误。这个问题能解决吗?
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/iostream:39:
In file included from /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/ostream:39:
In file included from /usr/lib/gcc/x86_64-linux
我试图在Linux中使用VSCode运行和调试器,但是当我运行或调试它时会出现以下错误:
启动:程序“输入程序名称,例如/home/user/Documents/Drexel/a.out”不存在,取消或打开“launch.json”
但是a.out存在:
VSCoe终端:
user:~/Documents/Drexel$ g++ helloworld.c
user:~/Documents/Drexel$ ./a.out
Hello C++ World from VS Code and the C++ extension!
user:~/Documents/Drexel$ gcc ccadd.c
我想在Linux - VSCode上使用C。因此,我推荐了教程 在VS代码中使用Linux上的C++ 使用C/C++扩展,并完成构建 你好,世界 ..。接下来, 我想通过添加adder.h/.c来测试"include .h“ //adder.h
#include
int add(int a, int b); //adder.c
#include "adder.h"
int add(int a, int b)
{
return a + b;
} //main.c
#include
#include "adder.h"
int main()
{
我最近下载了链接中提到的代码。我的GCC版本是4.1.2。在console中开始出现以下错误之前,编译过程至少进行了一个小时。
LLVM支持声明我需要使用gcc44-c++,这在我们的机器中是不可用的:
Red Hat Enterprise Linux Server release 5.5 (Tikanga)
# yum install gcc44-c++
Loaded plugins: security
ppsd-nonprod-base