错误:
————💗10.21————————
改了一个逻辑错误,一个书写错误。。
再次运行失败,错误如图:
刚才改的就是这里!还是没改出来!
继续改。。
再次报错,这次没有红色的error了。。
参考链接们:https://blog.csdn.net/aiwoziji13/article/details/7330333
https://blog.csdn.net/oguro/article/details/52675408其实加了头文件 但是写错了单词。。
make clean 一下 再次make,同上次的错误,应该还是函数跳转有问题。
添加
this->taskentity->DelPolicy::ExecDelPolicyTask(string DelPolicyFile);
错误变了
改一下头文件
make clean
错误:
原因是路径不正确
改一下后,错误激增。。
其中,关于分号的报错是因为:
更改后重新make
以上错误将DelPolicyTaskEntity()改成DelPolicy();
make
构造函数无返回值,但是代码本身就没有返回值啊。
哦!!有的 应该是DelPolicy(string caseid, string taskname, int taskid);
而不是DelPolicy DelPolicy(string caseid, string taskname, int taskid);
bug逐渐减少
In file included from caseentity/CaseEntity.cpp:14:0:
caseentity/../hostmonitor/HostMonitorManager.h:20:21: error: ‘HostMonitor’ was not declared in this scope
typedef map<string, HostMonitor*> STRING2HM;
^
caseentity/../hostmonitor/HostMonitorManager.h:20:33: error: template argument 2 is invalid
typedef map<string, HostMonitor*> STRING2HM;
^
caseentity/../hostmonitor/HostMonitorManager.h:20:33: error: template argument 4 is invalid
caseentity/../hostmonitor/HostMonitorManager.h:20:44: error: invalid type in declaration before ‘;’ token
typedef map<string, HostMonitor*> STRING2HM;
^
caseentity/../hostmonitor/HostMonitorManager.h:29:5: error: ‘HostMonitor’ does not name a type
HostMonitor* GetHostMonitorInstance(string caseid);
^
caseentity/CaseEntity.cpp: In member function ‘int CaseEntity::ManagerTaskEntity(std::string, int, std::string, std::string)’:
caseentity/CaseEntity.cpp:106:41: error: ‘DelPolicyTaskEntity’ is not a base of ‘BaseTaskEntity’
this->taskentity->DelPolicyTaskEntity::ExecTask(string DelPolicyFile);
^
caseentity/CaseEntity.cpp:106:57: error: expected primary-expression before ‘DelPolicyFile’
this->taskentity->DelPolicyTaskEntity::ExecTask(string DelPolicyFile);
^
其中,caseentity/CaseEntity.cpp:106:41: error: ‘DelPolicyTaskEntity’ is not a base of ‘BaseTaskEntity’ this->taskentity->DelPolicyTaskEntity::ExecTask(string DelPolicyFile);
应该是要改BaseTaskEntity,在BaseTaskEntity.cpp里添加
int BaseTaskEntity::ExecTask(string DelPolicyFile) {
return 0;
}
在BaseTaskEntity.h里添加
virtual int ExecTask(string DelPolicyFile);
将CaseEntity.cpp里面this->taskentity->ExecTask(); 改成this->taskentity->ExecTask(DelPolicyFile);
下一行注释掉。
再次make,还剩五个错误
一个都没查到QAQ TAT
带我一会再来看。。
——————————————
In file included from caseentity/CaseEntity.cpp:14:0:
caseentity/../hostmonitor/HostMonitorManager.h:20:21: error: ‘HostMonitor’ was not declared in this scope
typedef map<string, HostMonitor*> STRING2HM;
^
caseentity/../hostmonitor/HostMonitorManager.h:20:33: error: template argument 2 is invalid
typedef map<string, HostMonitor*> STRING2HM;
^
caseentity/../hostmonitor/HostMonitorManager.h:20:33: error: template argument 4 is invalid
caseentity/../hostmonitor/HostMonitorManager.h:20:44: error: invalid type in declaration before ‘;’ token
typedef map<string, HostMonitor*> STRING2HM;
^
这个问题好难找解决方案啊好不容易找到一个 要加std:: 的 试了一下还是报错。
尝试加头文件 错误不变。
尝试将HostMonitor改成了 class HostMonitor。
肯定不行啊 错误列表:
竟然轮回了!!之前出现过的错误!
- 创建新建项目要在编译器里右键创建
- NetBeans 创建makefile文件
- 再次make
这是成功了吗??
但是没有virtualmonitor可执行文件啊
make clean再make
一大片错误。。。😭
想改一下文件夹VirtualMonitor1.0的名字为VirtualMonitor 因为会重名所以想新建test文件夹 结果发现了test文件夹已存在 应该是观海初步测试的 于是新建test1
将VirtualMonitor1.0里的内容全部复制进去
make
还是同样的错误
`build/Debug/GNU-Linux/caseentity/CaseEntity.o: In function `CaseEntity::ManagerTaskEntity(std::string, int, std::string, std::string)':
/test1/VirtualMonitor/caseentity/CaseEntity.cpp:105: undefined reference to `DelPolicyTaskEntity::DelPolicyTaskEntity(std::string, std::string, int, std::string)'`
说明makefile文件没更新成功?
还是更新了makefile文件按也莫得用?
有一点点进展,在NetBeans打开项目 发现DelPolicy不在 于是加入
hold on 先问一下建华哥吧。。
答:可以构建,会生成自己的目录路径。
话说 在NetBean里构建和在Linux里make是一样的效果
(错误也都是一样的TAT)
在66服务器上构建的路径
/root/.netbeans/remote/192.168.125.66/desktop-akdlq6q-Windows-x86_64/C/Users/quze2/Desktop/virtualmonitor/VirtualMonitor1.0
头文件也添加了啊
改错误呀改错误
好多函数在DelPolicy.h里面没声明。
原来不是没加什么头文件按导致一大片错误,真的就是一个个不同的错误。。。
错误越改越多。。我哭了。。。
——————10.25——————————
其中,
这些都是因为DelPolicy Delpolicy这样是不对的!!
应该用::!!!
(唉我这水平。。我可以狗带了大概
((还是笑着活下去吧
继续改
传参时类型不一致,
将string改成int
未定义的变量
函数DealWithDelPolicyInfo()缺了一个参数 filterpolicy
加上参数
zaiDelPolicy类中调用了NetMonitor类(还是报错了)
将NetMonitorHandler.h中的 Ether_List_Head* filterrule; /*数据包过滤规则*/
改为public
将next改为rule_next后 还是报错;
————————1029————————
在DelPolicy.cpp里添加 ParseFilterPolicy和ParseEtherPro函数,已解决没法调用另一个类里面私有成员函数的问题。
解决这个问题DelPolicy/DelPolicy.cpp:326:9: error: ‘class DelPolicy’ has no member named ‘nmhmap’
查找一下 nmhmap.erase
原来是因为A类不能调用B类的私有成员变量 需要在B类里声明一个公有成员函数 用来调用B的私有成员变量 A类再调用B类的公有成员函数。
写