samedi 4 mai 2019

While creating a vector, getting error "implicit instantiation of undefined template ..."

I am getting "error: implicit instantiation of undefined template 'std::__1::vector >'", while compiling a simple code. Would appreciate if someone can help.

#include <iostream>
using namespace std;

class A {
public:
    A(long a, long b) {
        aa = a;
        bb = b;
    }
    A(const A &other) {
        aa = other.aa;
        bb = other.bb;
    }
private:
    long aa;
    long bb;
};

class B {
public:
    B() { }
private:
    vector<A*> vA;
};

int main()
{
    B b;
}

Below is the version of C++ I am using.

$ g++ --version 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Aucun commentaire:

Enregistrer un commentaire