i have a c++ project on eclipse and i can to use the string class in main file, but when i add a new file to the project I can not use any class.
I add file how: New-> Source file and select Template: Defaul c++ template source.
This is error src/Common.cpp:8:17: error: ‘string’ was not declared in this scope
and in src/AC.cpp all ok
thanks very much
Thanks larsman my simple code is:
AC.cpp -> all ok
include <iostream>
using namespace std;
int main()
{
string j = !!!Hello World!!!;
cout << j << endl; // prints !!!Hello World!!!
return 0;
}
Common.cpp -> src/Common.cpp:8:17: error: ‘string’ was not declared in this scope
#include <string>
void PrintTrace(string message)
{
string j = !!!Hello World!!!;
cout << j << endl; // prints !!!Hello World!!!
}
both files are the same project.
Thanks