0

Every time I create a simple program for eclipse I keep getting the same error:

Symbol cout could not be resolved, and # include expects "FILENAME or < FILENAME >

I've tried using #include iostream.h and changing that to #include <iostream> and adding using namespace std; to either version does not solve my issue and adds the problem: Symbol std could not be resolved.

#include <iostream>
using namespace std;

int main ()
{
    double radius = 11;     /*Centimeters*/
    double pi = 3.14;
    double sphere_volume = (4 / 3) * pi * (radius * radius * radius);
    double surface_area = 5 * pi * radius;
    cout << "Volume = " << sphere_volume;
    cout << "Area = " << surface_area;
    return 0;
}

The console should display the Volume and Area of a sphere with radius 11, but I'm not sure how to get it to accept cout so that it can print that result.

Tas
  • 7,023
  • 3
  • 36
  • 51
Jeff Wire
  • 11
  • 1
  • Your code compiles fine for me. Can you please show command line you use for compilation? Also can you please print the version of your compiler? BTW, `4/3 = 1`, since it's integer division. –  Jan 30 '19 at 05:27
  • As you no doubt already know, what you have [should compile](https://ideone.com/19aUev) (work as expected is a different issue). Make absolutely certain you are not compiling the program with gcc, a C compiler, instead of g++. – user4581301 Jan 30 '19 at 05:32
  • It sounds like you're building it as a C project instead of C++. – jcarpenter2 Jan 30 '19 at 05:33
  • Is that error message the actual one when changing to `#include `? It would make sense before that change but not really after fixing that. – Joachim Isaksson Jan 30 '19 at 05:35

1 Answers1

0

I attempted to use another source to install eclipse, and in the end I had installed a version that did not cooperate with my MinGW. Everything works as intended, thank you for your time.

Jeff Wire
  • 11
  • 1