我正在Linux上用C++开发一个程序。gcc的版本是4.5.1 20100924。我想在我的程序中使用std::atomic_int。我已经包含了原子头,如下所示:
include <atomic>
当我编译这个程序时,我得到了以下错误:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/atomic_base.h:87:0,
from /usr/lib/gcc/x86_64-redhat-linux/4.
我最近下载了链接中提到的代码。我的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
C和C++程序不在Angstrom上编译
C Progam (board.c):
#include<stdio.h>
void main(){
printf("hello world");
}
在Angstrom终端上编译C程序
root@pldek-beagle:~/Comparison# gcc board.c -o board
/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: this linker was not c
我想用来自C++ Standard Base 的Linux构建我的程序。程序依赖于Boost库,用gcc 4.4版本构建。编译失败。是否可以使用LSB C++编译器构建Boost库?或者,有没有可能用一些旧的gcc版本来构建Boost库,推荐的版本是什么?我的最终目标是让我的可执行文件和第三方Boost库在大多数Linux发行版上运行。
通常,通过使用Boost库开发C++闭源应用程序,可以为Linux发行版获得更好的二进制兼容性?
在linux上编译我的cpp文件时,使用以下行:
$ g++ -o blabla blabla.cpp
我在stdout上收到以下消息:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/array:35,
from blabla.cpp:5: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../
include/c++/4.4.7/c++0x_warning.h:31:2:
error: #error T
我正在尝试编译一个包含<iostream>头的简单c++代码。令人惊讶的是,我正面临着我以前从未遇到过的错误。如果删除了<iostream>头,一切都会正常工作。
代码:
#include <iostream>
int main(){
return 0;
}
编译错误:
$ g++ temp.cpp
In file included from /usr/lib/gcc/x86_64-linux-gnu/7/include/stdint.h:9:0,
from /usr/include/c++/7/cstdint:4
int delta[4][2] = {{0,1},{1,0},{0,-1},{-1,0}};
random_shuffle(&delta[0],&delta[4]);
编译错误:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h: In function 'void std::swap(_Tp&, _Tp&) [with _Tp = int [2]]':
/usr/lib/gcc/x86_64-redhat-linux/
我正在为Eclipse中的自动工具插件和我下载的一些C++项目而苦苦挣扎。
我的目标是在arm处理器上进行交叉编译,因此该项目已经配置为使用自动工具,但是当我尝试交叉编译时,我遇到了以下问题
In file included from /usr/include/c++/4.6/bits/stl_algo.h:61:0,
from /usr/include/c++/4.6/algorithm:63,
from dtntracepath.cpp:17:
/usr/include/c++/4.6/cstdlib:119:11: er
我目前在CS班上,我们使用C++,我在我的笔记本上运行Linux。所以问题是我想我没有最新版本的C++。我已经在线阅读了几个获取版本的命令,这就是我的结果。另外,我的Linux版本是16.04,我正在我的终端上编译
tom@TBT-XPS-13-9360:~/Documents/Subjects/CS/OOP$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see t
我使用的是Windows7-32位操作系统。
我希望将我的简单C++源代码编译成所有OSes和体系结构的可执行文件。
我想从我的操作系统编译下面的操作系统。
Windows 32
Windows 64
Linux 32
Linux 64
OSX 32
OSX 64
有可能吗?
注意:--我需要用Win7 32位来编译所有OSes的C++。
我有一个C++项目,它最初是用Visual Studio for Windows编写的。它包含对英特尔MKL的调用以及一些OMP代码。有不同的向量和矩阵运算。我已经在微软和windows上的英特尔编译器的VS中测试了它的发布和调试,没有任何问题。
我已经使用Eclipse和英特尔C++编译器将其移植到Linux上。在调试配置中,测试是通过的,但是当我将优化级别从Disabled (-O0)更改为MaximizeSpeed(-O2)时。测试开始失败,某些地方的计算会产生不同的结果(~10%)。在启用优化的情况下,相同的英特尔编译器在Linux上产生不同结果的原因是什么?有什么想法需要检查一下吗?