C++ templated class multiple inheritance from different unit

This is a discussion on C++ templated class multiple inheritance from different unit within the C++ Programming forums, part of the General Programming Boards category; I've a Class paramsMapCore Code: template <typename KeyType, typename ValueType> class paramsMapCore : public std::map<KeyType, ValueType>{ ... } and another ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    219

    C++ templated class multiple inheritance from different unit

    I've a Class paramsMapCore
    Code:
    template <typename KeyType, typename ValueType>
    class paramsMapCore : public std::map<KeyType, ValueType>{
      ...
    }
    and another Class paramsMap that extends paramsMapCore
    Code:
    class paramsMap : public paramsMapCore<string, Var>{
      ...
    }
    both of this class stays in a different subdirectory called cgi
    and they are not in any namespace

    under that cgi Directory there is another Directory called jsutil
    which has a class Called Js::Object. All Classes in this directory are member of Js namespace.

    By the way I am using autotools to manage the build system.
    Code:
    namespace Js{
    
    class Object: public Js::JVar, public paramsMapCore<string*, Js::JVar*>{
      ...
    }
    
    }
    If I remove jsutil subdirectory from cgi/Makefile.am everything works fine and both paramsMap and paramsMapCore compiles and works.

    but here when I inherit paramsMapCore on Js::Object It gives Compilation Errors.

    Code:
    compiling object.cpp (g++)
    compiling object.cpp (g++)
    cgi/jsutil/../paramsmap.h:36: error: expected template-name before '&lt;' token
    cgi/jsutil/../paramsmap.h:36: error: expected `{' before '&lt;' token
    cgi/jsutil/../paramsmap.h:36: error: expected unqualified-id before '&lt;' token
    cgi/jsutil/object.cpp:34: instantiated from here
    cgi/jsutil/../paramsmapcore.hpp:38: error: conversion from 'Var' to 'Js::JVar*' is ambiguous
    cgi/jsutil/../var.h:177: note: candidates are: Var::operator int() const &lt;near match&gt;
    cgi/jsutil/../var.h:176: note: Var::operator long int() const &lt;near match&gt;
    cgi/jsutil/../var.h:175: note: Var::operator char() const &lt;near match&gt;
    Not getting any clue to identify the errors.
    Please help urgently everything stuck on this point.

    I think Its problem of Makefiles If requered I can post my makefiles.am too

    one thing I cant understand is when I can compiling the jsutil subdirectory its firing compilation errors from another class of different module.
    but If I just remove the jsutil subdirectory It compiles Fine..
    and I am using the paramsMapCore Class here so Why Its dealing with pramsMap Class.
    Last edited by noobcpp; 10-19-2008 at 10:43 AM.

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    219
    I've restructured my code to idenfy and simplify the thing. and I've started a new Thread on http://cboard.cprogramming.com/showt...203#post798203
    Please reply there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-31-2005, 11:05 AM
  2. Multiple Inheritance Ambiguity
    By FillYourBrain in forum C++ Programming
    Replies: 21
    Last Post: 08-23-2002, 10:31 AM
  3. C++ multiple inheritance problem
    By pongsor in forum C++ Programming
    Replies: 7
    Last Post: 02-08-2002, 07:18 PM
  4. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM
  5. Multiple virtual inheritance
    By kitten in forum C++ Programming
    Replies: 3
    Last Post: 08-10-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21