C++ code compilation problem - issues with difference in standards

John Love-Jensen eljay@adobe.com
Wed Sep 10 13:42:00 GMT 2003


Hi,

You should get compile errors, since the 'string' identifier is in the 'std'
namespace, and has been since C++ was standardized (ISO 14882).  Back in
1998.

One better approach is to do this:
---------------------------------------------------------------------------
#include <iostream>
  using std::cout;
  using std::endl;

#include <string>
  using std::string;

int main() {
  string second = " WORLD !";
  string mesg = "HELLO" + second;
  cout << mesg << endl;
}
---------------------------------------------------------------------------

--Eljay



More information about the Gcc-help mailing list