error: cannot convert ‘std::map<_client, _stime, std::less<_client>, std::allocator
第一个参数有问题,当时是在以前的函数也有定义了一个变量,我又重新定义了同名变量,起了冲突。
no ‘bool DlDatadeal::pop_Client()’ member function declared in class
DlDatadeal::pop_Client()函数已经有了,还是抱没有的错误。一大堆这样的错误,结果是在放c的文件夹中多了个.h文件。
pthread_create()报参数不匹配
pthread_create方法遇到类方法时总会报 argument of type ‘void* (Thread::)(void*)’ does not match ‘void* (*)(void*)’
pthread_create方法第三个参数只能是C函数指针或者类到静态函数指针。
pthread_create(&threads[0], NULL, inc_count, NULL); //必须是C函数指针
pthread_create(&threads[1], NULL, Thread::work, &obj); //或者时类静态函数指针
编译时出现错误:error: cast from ‘char*’ to ‘int’ loses precision
有关于编译的系统,系统的指针类型和long型大小相等(8B)而与int型4B,故会出现:loses precision。
把int改成long就行了。
obj/Release/process.o:/home/ptest/deeplog-master/dl_analysed/workspace/gnu/../../source/process.cpp:2472: multiple definition of `m_mapSlow'
obj/Release/dlentity.o:/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_tree.h:448: first defined here
一堆类似的错误,是定义全局变量出现的错误,主要是没有加上extern关键字,声明定义。或可考虑将变量定义为static类型的。
error: 'for' loop initial declarations are only allowed in C99 mode
for(int i=0;i<10;i++);报这个错是编译方式有问题,gcc是C98 编译的
可以这样:gcc src.c -std=c99 -o src 或者g++编译;
error: base operand of ‘->’ has non-pointer type ‘std::map<_keyword_dir, int, std::less<_keyword_dir>, std::allocator
报错,是吧‘->’改成‘.’才通过。