Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

catastrophic error: could not open source file

brunocalado
Beginner
1,938 Views

Hi,

What I can do to solve this?

root@ubuntu:/opt/intel/cc/10.1.018/bin# ./icc teste.c
teste.c(1): catastrophic error: could not open source file "iostream.h"
#include
^

compilation aborted for teste.c (code 4)

teste.c Code:

#include

int mult (int x, int y) {

int result;
result = 0;
while (y != 0) {
result = result + x;
y = y - 1;
}

return(result);
}

int main () {
int x, y;
cout << "Enter two natural numbers: ";
cin >> x >> y;
cout << x << " * " << y << " = " << mult(x,y) << endl;
return(0);
}

I'm using: Ubuntu 8,10

0 Kudos
1 Solution
TimP
Honored Contributor III
1,938 Views
Quoting - brunocalado

teste.c(17): error: identifier "cout" is undefined
cout << "Enter two natural numbers: ";
^

teste.c(18): error: identifier "cin" is undefined
cin >> x >> y;
^

teste.c(19): error: identifier "endl" is undefined
cout << x << " * " << y << " = " << mult(x,y) << endl;

You didn't show your code example. My guess is you omitted

using namespace std;

View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
1,938 Views

There is no C , If you mean to use C++, that's the purpose of icpc. I won't comment on pros and cons of vs , beyond pointing out there are concerns.

0 Kudos
brunocalado
Beginner
1,938 Views

Thank you.

I change iostream.h for iostream. And use ./icpc teste.c

But...

root@ubuntu:/opt/intel/cc/10.1.018/bin# ./icpc teste.c
teste.c(17): error: identifier "cout" is undefined
cout << "Enter two natural numbers: ";
^

teste.c(18): error: identifier "cin" is undefined
cin >> x >> y;
^

teste.c(19): error: identifier "endl" is undefined
cout << x << " * " << y << " = " << mult(x,y) << endl;
^

compilation aborted for teste.c (code 2)

0 Kudos
TimP
Honored Contributor III
1,939 Views
Quoting - brunocalado

teste.c(17): error: identifier "cout" is undefined
cout << "Enter two natural numbers: ";
^

teste.c(18): error: identifier "cin" is undefined
cin >> x >> y;
^

teste.c(19): error: identifier "endl" is undefined
cout << x << " * " << y << " = " << mult(x,y) << endl;

You didn't show your code example. My guess is you omitted

using namespace std;

0 Kudos
Reply