Why am I getting so many errors?

I am using eclipse to write up my programs on my macbook pro. I used a windows computer for this (back when it worked) and did not get these errors. The program will still run but it will show that I have errors. I'm using the version Luna Service Release 1 (4.4.1) for C/C++ and the GCC C++ compiler (built on on the mac or something).
And it doesn't matter what code I put, even just the simple hello world so i know it's not my code.
So, for example (even when my code is completly finished and otherwise error free,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <iostream>
#include<cmath>
// will give the errors: "Unresolved inclusion: <iostream>" and
//"Unresolved inclusion: <cmath>" 

using namespace std;
//will tell me "Symbol 'std' could not be resolved"

cout << x1 << " " << x2 << endl;
//this tells me: "Multiple markers at this line
	// Symbol 'endl' could not be 
	// resolved
	// Symbol 'cout' could not be 
	// resolved" 


What should I do to try to fix this? It's hard to recognize where I actually have errors when these errors are so plentiful.
Let me know if you need any extra info.
Thanks

Because I probably have no idea what i'm talking about, it might be easier to show you
http://i45.photobucket.com/albums/f99/overthewater/ScreenShot2014-10-23at31215PM_zps03de6b32.png
http://i45.photobucket.com/albums/f99/overthewater/ScreenShot2014-10-23at31257PM_zps63ce4d00.png
Last edited on
Looks just like the compiler you are using doesn't know where those include libraries are. Need to fix that first.
Strange that you are able to run the program if there are errors. Maybe posting the full compiler output will give some clues.
How would I fix that? I'm not even sure how to google that to know where to start

And what is the complier output? I'm shamefully new at this. Where would I find it?
what is the complier output?

I think Eclipse shows it in the bottom. I mean all the text that is produced when you compile, the errors, and if it shows the command that is used to compile the code that would be useful too.
And it works fine. It builds, debugs, and launches without telling me any errors.
When I launch it, it only does what it's supposed to do.
When I go to build 'debug' it says:

15:59:15 **** Incremental Build of configuration Debug for project Motion ****
make all
Building file: ../freefall.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"freefall.d" -MT"freefall.d" -o "freefall.o" "../freefall.cpp"
Finished building: ../freefall.cpp

Building target: Motion
Invoking: MacOS X C++ Linker
g++ -o "Motion" ./freefallfunctions.o ./freefall.o
Finished building target: Motion


15:59:16 Build Finished (took 364ms)
But you said there where errors? Where are the errors you talked about? Only in the code area?
Last edited on
Yes. I guess so. When I was working on something yesterday it was off and on about whether it would let me launch the program but right now the errors are only showing in the actual code.

Because I probably have no idea what i'm talking about, it might be easier to show you
http://i45.photobucket.com/albums/f99/overthewater/ScreenShot2014-10-23at31215PM_zps03de6b32.png
http://i45.photobucket.com/albums/f99/overthewater/ScreenShot2014-10-23at31257PM_zps63ce4d00.png


Invalid project path: Include path not found (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1). Assignment 4 pathentry Path Entry Problem

not sure if this helps, but it lists this as one of the errors is the "problems" section
I've tried not using "using namespace std;" and just writing it out normally but it still says symbol 'cout' could not be resolved.
first where is your main function??
second you never declared your variable or gave them any value.
1
2
3
4
5
int main()
{


}


did you save the file as a cpp ? since you are using eclipse you may have saved it as a java file
Last edited on
Those aren't "errors". They are Eclipse's version of Intellisense.

What it is saying is that it doesn't understand what "std" is.
(I wonder if you put a space between "include" and the angle bracket would make a difference, like this:
#include <iostream> ?)

Spoiler: I've never used Eclipse.

Is it possible that Eclipse doesn't think you are editing a C++ program?
Also make sure to observe mobotus's and overthewater's answers.

Good luck!
Last edited on
Topic archived. No new replies allowed.