编译常见问题集

1

warning: incompatible implicit declaration of built-in function ‘memset’ [enabled by default]
原因:调用了memset,用于初始化内存中的数据,但是没有指定memset这个函数来自于哪里。
解决方法:在文件头加入 #include <string.h>

2

warning: assignment from incompatible pointer type [enabled by default]
原因:指针的类型不一致
解决方法:把指针类型强制转换一下,使其一致

3

warning: comparison between pointer and integer [enabled by default]
原因:指针与整数进行比较,比较的数据类型不一致;
解决:*clientRTCPPortNum = (streamingMode == RAW_UDP ? 0 : p1 + 1);
streamingMode本身是个指针,漏掉了一个 *
修改为:*clientRTCPPortNum = (*streamingMode == RAW_UDP ? 0 : p1 + 1);警告解决。

4

warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]
解决方法:在文件头加入 #include <unistd.h>

5

warning: implicit declaration of function ‘pthread_detach’ [-Wimplicit-function-declaration]
解决方法:在文件头加入 #include <pthread.h>

6

报错:error: jump to label [-fpermissive]
解决方法:
原因很简单,goto 之后,又出现了新定义的变量。
在goto之前定义变量即可解决。

猜你喜欢

转载自blog.csdn.net/u014470361/article/details/98589363
今日推荐