C ++ Different compilation error with gcc and visual studio, 'in this context'


I've posted a similar question before but I had a slight mistake in the code so it was disregarded, let me ask again.

In Gcc I get the exact line of compilation error In VS2010/2012 I have no Idea where the compilation error is, can anyone help? ** In VS how was I supposed to know what line invoked it?

I have the following code:

#include "ObjectHolder.h"

int main()
    ObjectHolder first(1);
    ObjectHolder second(first);
    return 0;
#ifndef NonCopyableObject_Included
#define NonCopyableObject_Included

class NonCopyableObject
        virtual ~NonCopyableObject () {}

        NonCopyableObject(int i) { m_index = i;}
        int m_index;
        NonCopyableObject(const NonCopyableObject& other) {}

#ifndef ObjectHolder_Included
#define ObjectHolder_Included
#include "NonCopyableObject.h"

class ObjectHolder
        virtual ~ObjectHolder ();
        ObjectHolder(int i) : obj(i) {}

        NonCopyableObject obj;

VS Error:

1>d:\users\user\documents\visual studio 2012\projects\tester\tester\objectholder.h(13): 

     error C2248: 'NonCopyableObject::NonCopyableObject' : cannot access private member declared in   class 'NonCopyableObject'
               d:\users\user\documents\visual studio 2012\projects\tester\tester
     \noncopyableobject.h(13) : see declaration of 'NonCopyableObject::NonCopyableObject'
            d:\users\user\documents\visual studio 2012\projects\tester\tester
     \noncopyableobject.h(6) : see declaration of 'NonCopyableObject'
            This diagnostic occurred in the compiler generated function
     'ObjectHolder::ObjectHolder(const ObjectHolder &)'


$ g++ -Wall -Werror --std=c++0x main.cpp -o test_no_copy
In file included from main.cpp:2:0:

     NonCopyableObject.h: In copy constructor `ObjectHolder::ObjectHolder(const ObjectHolder&)':
     NonCopyableObject.h:13:3: error: `NonCopyableObject::NonCopyableObject(const NonCopyableObject&)' is private
     ObjectHolder.h:7:1: error: within this context
     main.cpp: In function `int main()':
     main.cpp:8:27: note: synthesized method `ObjectHolder::ObjectHolder(const ObjectHolder&)' first required here

The compiler cannot generate (synthesize) a copy-constructor in ObjectHolder because it contains an object of class NonCopyableObject which has a private copy-contructor.

By default the generated copy-constructor is invoking the copy-constructor of all member- and parent objects.