1. error:expected primary-expression before 'unsigned'
有可能是 unsigned 前面的 符号 是全角型,而不是 半角型。
2. error: invalid conversion from ‘const void*’ to ‘void*’
由于gcc版本较高,类型检查较为严格,这边是 字符串的问题,比如
pthread_cleanup_push(cleanup, "thread 1 first handler"); "thread 1 first handler"前 需要添加 (void *) 进行类型强制转换
3. error: invalid conversion from ‘void*’ to ‘foo*’
源代码:
添加修改后如下:
if ((fp = (struct foo*)malloc(sizeof(struct foo))) != NULL)
4.
main.cpp:9: error: expected template-name before ‘<’ token
main.cpp:9: error: expected ‘{’ before ‘<’ token
main.cpp:9: error: expected unqualified-id before '<' token
这个是头文件引用不当引起或者使用某个容器,却没包含这个容器的头文件
比如 使用了list容器,就应该写 #include <list>
5.main.cpp: In function ‘int main()’:
main.cpp:43: error: expected unqualified-id before ‘.’ token
main.cpp:44: error: expected unqualified-id before ‘-id beforV
使用typedef 自定义了一个类型名,而在下面引用的时候把类型名当做变量直接使用
main.cpp: In member function ‘typename std::list<T, std::allocator<_CharT> >::iterator MyList<T>::find(const T&) [with T = PicBuffer*]’:
main.cpp:77: instantiated from here
main.cpp:39: error: no matching function for call to ‘find(std::_List_iterator<PicBuffer*>, std::_List_iterator<PicBuffer*>, PicBuffer* cons { T cTB
6、 > >不能写成 >>紧挨在一起
typedef MyList<std::vector<int> > ListVector;
7、linux编译中error: no arguments depend on a template parameter, declaration of * must 解决 http://hi.baidu.com/laoliang1984/item/6b1066bf82a27040ba0e12e1
-fpic:产生位置无关码 解释一下,位置无关码就是可以在进程的任意内存位置执行的目标码,动态链接必须使用。
其中dlfch.h是一个调用动态链接库用的头文件。
9 、main.cpp:5: error: expected unqualified-id before ‘template’
关键字 template不能作为变量名。
10、
tar: root_qtopia/usr/sbin/telnetd:无法创建到 “../../bin/busybox” 的符号连接: 操作不允许
tar: root_qtopia/usr/sbin/fbset:无法创建到 “../../bin/busybox” 的符号连接: 操作不允许
tar: 由于前面延迟的错误而退出
原因:不能使用tar命令在window分区下解压文件夹
11、
12、
main.c|62| warning: passing argument 2 of ‘lh_doall_arg’ from incompatible pointer type
将第二个参数添加(void *)进行强制转换,即可消除告警
13、
invalid conversion from ‘void (*)()’ to ‘void (*)(int)’
函数参数个数或者类型不对应
#include <stdio.h>
#include <signal.h>
void signal_handler()
{
printf("hello, world!\n");
//alarm(1);
}
int main()
{
signal(SIGINT, signal_handler);
while(1)
{
}
return 0;
}
void signal_handler()
写成 void signal_handler(int signum); 即可编译通过。