3

所以我一直在尝试安装DDD。我在 Mac OS X 10.9(Mavericks) 上,并且安装了最新的 Xcode。每当我运行我的配置文件时,我得到的最后一件事是:

checking whether c++ accepts -g... yes
checking whether the C++ compiler (c++) compiles a simple program... no
configure: error: You must set the environment variable CXX to a working 
                  C++ compiler.  Also check the CXXFLAGS settings.
                  See the file 'config.log' for further diagnostics.

每当我检查 config.log 文件时,我都会得到:

configure:2684: c++ -o conftest -g -O2   conftest.C  1>&5
configure:2678:10: fatal error: 'iostream.h' file not found #include <iostream.h>
1 error generated.
configure: failed program was:
#line 2677 "configure"
#include "confdefs.h"
#include <iostream.h>
int main() {
cout << "hello, world!";
; return 0; }

我已经从 sourcefourge 下载了 gcc 并再次安装了 gcc-4.9,但我仍然遇到同样的错误。任何人都知道如何解决这个问题或可能是什么问题?

4

2 回答 2

0

似乎您正在编译 c++ 程序,但您将.c文件传递给c++编译器。您将conftest.c文件传递给 c++ 编译器,它必须是confest.cpp.

configure:2684: c++ -o conftest -g -O2 conftest.C 1>&5

这必须是

configure:2684: c++ -o conftest -g -O2 conftest.cpp 1>&5

fatal error: 'iostream.h' file not found #include <iostream.h> 1 error generated.

对于上述错误更改您的代码

#included <iostream>

代替#include <iostream.h>

于 2014-01-29T05:43:13.440 回答
0

只需打开您在 DDD 目录中的配置文件并添加以下内容

`<iostream>
 using namespace std;

` 这应该可以解决这个错误

于 2020-05-07T21:31:04.453 回答