Hi Incongruous!

On Fri, Sep 6, 2013 at 7:56 PM, Incongruous <[email protected]> wrote:
> OooooKay?
>
> Code Snip
> ~~~~~~~~
>     #include <memory> //share_ptr
>      std::shared_ptr<abc::someClass> apx; //<--Does not work
>
> Error
> ~~~~
> g++    -c -g -I/c/abc -I/c/abc/gui/msg/ -MMD -MP -MF

std::shared_ptr is new to c++11, so you probably have to turn on
c++11 with g++.  (Actually only sort of new; as you know, shared_ptr
had been in namespace tr1.)

===== test.cpp =====

#include <memory>
std::shared_ptr<int> p;

===== test.cpp =====

The compile command "g++ -std=c++11 -c test.cpp" works, but
"g++ -c test.cpp" fails with the error:

   test.cpp:2:1: error: 'shared_ptr' in namespace 'std' does not name a type
    std::shared_ptr<int> p;
    ^

My version of g++ is

   g++ --version
   g++ (rubenvb-4.8-stdthread) 4.8.1 20130324 (prerelease)

> What do I want?
> ~~~~~~~~~~~~~~~
> I would like to know if MinGW is able to compile the line above or if C++11
> compliant. I know that VS2010+ has not problem compiling the code above.

Yes, mingw-w64 is able to compile this code, but you have to
tell it explicitly to use c++11; is doesn't by default.

(You can also use "-std=gnu++11" if you want both c++11 and
some of the gniu extensions.)

> TIA (Thanks in advance )


Happy C++11 Hacking!


K. Frank

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58041391&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to