[OpenIndiana-discuss] weird C++ problem
Ian Collins
ian at ianshome.com
Mon Apr 1 20:54:36 UTC 2013
Apostolos Syropoulos wrote:
> Hello everybody,
>
> I was trying to compile a program and one file failed to compile
> with g++ 4.7.2 but it compiles with CC: Sun C++ 5.12 SunOS_i386 2011/11/16.
>
> The following little program reproduces the error I got initially:
>
> #include <iostream>
> #include <string>
> using namespace std;
> namespace KPS {
> extern "C" {
> #include <string.h> //it includes another header that eventually
> } // included this header.
> }
> using namespace KPS;
>
> int main() {
> std::string x;
> string y = "abcdef";
> cout << y << endl;
> }
What options did you pass to the compiler? The snippet compiles fine
with gcc 4.5.2 (Solaris 11) and 4.6.2 (SmartOS).
--
Ian.
More information about the OpenIndiana-discuss
mailing list