POV-Ray : Newsgroups : povray.off-topic : Adventures with C++ : Re: An actual C++ question Server Time
29 Jul 2024 02:30:21 EDT (-0400)
  Re: An actual C++ question  
From: Orchid Win7 v1
Date: 17 May 2013 13:20:28
Message: <519666dc$1@news.povray.org>
On 16/05/2013 08:39 AM, Orchid Win7 v1 wrote:
>>> class PrivateClass;
>>
>>> class MyClass
>>> {
>>> std::shared_ptr<PrivateClass> privateObject;
>>> };
>
> OK. That seems easy enough.

I entered this into VisualStudio, and it worked great.

However, when I tried to compile it under Linux, GCC refused to accept it.

First, VS seems to somehow allow you to compile things even without 
actually importing the necessary include files. (E.g., it will happily 
accept std::shared_ptr even though I didn't #include <memory>.) GCC 
demands that you actually specify the include files [like you'd expect]. 
Weird, but true.

Second, it seems this "feature" only exists in C++11. I don't know what 
GCC is defaulting to, but apparently you have to add a switch to tell it 
to accept C++11. And when I do that, my code compiles perfectly, but the 
rest of the codebase breaks spectacularly.

So, in summary, I had to revert everything back to how it was. *sigh*


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.