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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux