Re:



2012/9/29 ArbolOne <arbolone gmail com>:
> Sorry, I know that this is not a gtkmm code, but I need to plug a template
> similar to this one in my gtkmm program, and for some reason it will not
> compile.

Actual error given by compiler would be helpful.

> I just might be that I tired, but I cannot see anything wrong in
> this code.
> template <class T> class Data{
> private:
>     T data;
> public:
>     Data();
>     Data(T);
>     virtual ~Data();
> };
> template <class T>
> jme::Data<T>::Data() {}
>
> template <class T>
> jme::Data<T>::Data(T _data) {
>     this->data = _data;
> }
> template <class T>
> jme::Data<T>::~Data() {}
> .............
> using namespace std;
> int main() {
>     jme::Data<int> d(1); // this does not work
>     jme::Data<int> d; // this does not work
>     cout << "Hello world!" << endl;
>     return 0;
> }

I added #include <iostream>, removed all "jme::" and renamed d
variables in main to d1 and d2 and it compiled.

Or maybe it is that - you just have two "d" variables in main.

> --
> Happiness has many doors, and when one of them closes another opens, yet we
> spent so much time looking at the one that just closed that we don't see the
> one that just opened..
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]