c++ - 在 Debian 测试 x64 中无法编译 c++ 4.7.2

标签 c++ gcc debian gcc4.7

我正在尝试在 debian 测试 x64 位中使用 g++ 进行手动编译,

我的文件test.cpp的内容是:

#include <iostream>

using namespace std;

int main() {

  cout << "Hola Mundo" << endl;

  return 0;

}

但是当我运行命令时,例如编译一个简单的 hello word

g++ test.cpp -o test

当我运行命令 ls 时:

test.cpp

g++ 什么都不生成。很少见。

基本上我尝试用 c++ 编译的任何程序都会发生这种情况。

关于我的 Debian 的数据:

内核: 3.9-1-amd64

关于g++的资料(运行命令g++ -v):

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-        bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 

如何解决我的问题?

谢谢。

最佳答案

您是否尝试添加编译器命令以获得更详细的信息?

-Wall -g

如果你点击它,也许它会起作用?

g++ -o test test.cpp

关于c++ - 在 Debian 测试 x64 中无法编译 c++ 4.7.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18168467/

相关文章:

c++ - 过滤图像 OpenCV 中的植物/杂波

c - 错误 : ‘struct addrinfo’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]|

memory - NOPs指令存储在内存中使用\x符号

c - 驱动程序编程简介

c++ - 如何在不受其他文件影响的情况下在 Visual Studio 项目中运行 C++ 文件 "by itself"?

c++ - 具有 pop_back 函数的类模板 vector 无法按预期工作

c++ - 无法创建 d3d 设备

postgresql - 链接到静态库以构建静态可执行文件

java - Android SDK 更新失败,说-> http ://dl-ssl. google.com/android/repository/repository.xml 的 XML 验证失败

php - 从 php 代码在 debian 中安装驱动器