简体   繁体   中英

eclipse CDT issue on Mac OSX

On one of my Mac box, for simple Hello Word C++ program, there are such compile error, other Macs I am working on are ok. Using even the same version of Eclipse CDT 64-bit Mars.

Posted error and Hello Word program, does anyone have any hints? Thanks.

//============================================================================
// Name        : Test1.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

在此输入图像描述 在此输入图像描述

Attach error from g++ of command line,

g++ Test1.cpp Test1.cpp:9:20: error: iostream: No such file or directory Test1.cpp: In function 'int main()': Test1.cpp:13: error: 'cout' was not declared in this scope Test1.cpp:13: error: 'endl' was not declared in this scope

In summary, if whether you're developing in C, C++ or Objective C on the Mac, you probably just want to use XCode.

Not sure what Eclipse was doing, but (see link in comments) earlier versions of Eclipse might work where later ones will not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM