4

I built a simple program in eclipse:

#include <iostream>

using namespace std;
int main()
{
    cout << "TEST" << endl;
    return 0;
}

It worked in Visual Studio and CodeBlocks, but eclipse is acting weird. it says:

Unresolved inclusion: <iostream>

I read here: C++ - Unresolved inclusion: <iostream>

and here: Unresolved <iostream> in Eclipse, Ubuntu

and neither of them worked.

Here are screenshots of project properties:

build_settings general

edit:

I downloaded MinGW and now i have this under Settings:

Updated_Settings

How should i proceed? Maybe now i don't need #include <iostream> because it's now included in the project?

include

I found iostream under Includes.

So i tried deleting #include <iostream>, but when i try to run the program i get: Launch Failed. Binary not found. error:

launch_failed

Thanks

edit:

Seems like if i compile in some other program (say CodeBlocks) and create the exe file, then eclipse can run it. But it can't build its own exe.

Why?

Community
  • 1
  • 1
Alaa M.
  • 4,961
  • 10
  • 54
  • 95

3 Answers3

1

This answer did not help me either. My issue was solved with the following steps:

You might try changing your source files from *.c to *.cpp. This will provoke gcc to think of the files as C++ and search the proper paths. Might need to make small modifications to the Makefile as well, like on the OBJ: line. Instead of:

OBJS = YourFile.o

try

OBJS = YourFile.cpp

Bruce Chidester
  • 621
  • 1
  • 5
  • 16
0

I've searched for a few hours and tried a lot solutions.

Envirment: windows, Eclipse IDE for C/C++ Developers

Version: Kepler Service Release 2

CDT: 8.3.0

Following steps works for me:

  1. make sure the envirement is clear. => I suggest delete the eclipse and unzip it again from your orginal download.

  2. make sure the workspace is clear. => Delete .metadata folder in your workspace folder.

  3. use valid MinGW. => the one using download tool is slow and I'm not sure which one to select. I suggest download MinGWStudio from http://vaultec.mbnet.fi/mingwstudio.php This is a IDE tool like eclipse contains a downloaded unzip MinGW. Make sure you download the one plus MinGW compiler which is about 20M. You can use this studio if you want or copy the MinGW folder to C:/ if you still prefer eclipse. Copy /MinGW inside /MinGWStudio to C:/.

  4. close your eclipse and reopen it, create a new project, you should able to see MinGW section for new project option, and it will auto map g++, gcc and include files under C:/MinGW folder. Just make sure you copy MinGW folder from MinGWStudio to the root of C:/.

You will able to see your include after these steps.

includes_screen_cast

Peng Zup
  • 1
  • 4
-2

right click your project click properties goto C/C++ Build > settings click on Misc. under GCC C++ Compiler and the other flags code should have this after it -std=c++11 then go to Misc. under GCC C Compiler and add this to the other flags code -std=gnu11 apply save your project build your project and it should work

BlueTechM
  • 1
  • 1