Lin Ma
Lin Ma

Reputation: 10139

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;
}

enter image description here enter image description here

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

Upvotes: 5

Views: 259

Answers (1)

BillRobertson42
BillRobertson42

Reputation: 12883

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.

Upvotes: 1

Related Questions