得到错误"基类未定义"但基类似乎已定义

时间:2016-08-23 14:24:39

标签: c++ include

// Package header #include "hmtcpip.h" #include "hmtimer.hpp" #include "MbusSlaveServer.hpp" 我有

class
#if defined (_WINDLL) || defined(__DLL__)
   __declspec(dllexport)
#endif
MbusTcpSlaveProtocol: public MbusSlaveServer
{

  protected:

   enum
   {
      // MBAP prefix
      MBAP_HDR_LEN = 6,
      // Header is MBAP prefix + 1 byte function + 1 byte address
      HDR_LEN = MBAP_HDR_LEN + 2,
      // Frame is same as header for this protocol
      FRAME_LEN = HDR_LEN,
      // TCP max. message size is data size + frame length:
      MAX_MSG_SIZE = MAX_DATA_SIZE + FRAME_LEN
   };

   char bufferArr[MAX_MSG_SIZE];


   public:

以及几行我有以下内容:

MbusTcpSlaveProtocol: public MbusSlaveServer:

当我使用Microsoft Visual Studio Community 2015进行编译时,我在MbusSlaveServer.hpp行上收到错误消息:

  

错误C2504' MbusSlaveServer&#39 ;:基类未定义

然后我可以通过右键单击基类来转到class #if defined (_WINDLL) || defined(__DLL__) __declspec(dllexport) #endif MbusSlaveServer { protected: enum { PDU_SIZE = 253, 文件(下面)中的定义,并且"转到定义":

function setDefault(user, def) {
    Object.keys(def).forEach(function (k) {
        if (def[k] !== null && typeof def[k] === 'object') {
            if (!(k in user)) {
                user[k] = {};
            }
            setDefault(user[k], def[k]);
            return;
        }
        if (!(k in user)) {
            user[k] = def[k];
        }
    });
}

var defaultOptions = { monit: { map: { googleMap: false }, vehiclesList: { rightSide: false, number: true, driver: true, note: true, }, vehicleCloud: { speed: true, date: true, alarms: true, fuelsCloud: true }, driverCloud: true } },
    userCacheOptions = { monit: { vehiclesList: { rightSide: false, number: false, driver: false }, vehicleCloud: { speed: true, date: true, alarms: true, fuelsCloud: true }, } };

setDefault(userCacheOptions, defaultOptions);

console.log(userCacheOptions);

我不明白编译器如何认为基类是未定义的,但接口可以找到定义。

0 个答案:

没有答案