Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse CDT issue on Mac OSX

Tags:

c++

macos

eclipse

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

like image 931
Lin Ma Avatar asked Nov 10 '22 02:11

Lin Ma


1 Answers

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.

like image 159
Bill Avatar answered Nov 14 '22 22:11

Bill