ubuntu下编译时遇到的错误及解决方式
2013-08-23 19:23
330 查看
1、错误展示:
hangma@ubuntu:~/test/test/protest/stack_test$ gcc -c my_stack.c -o my_stack.o
In file included from /usr/include/stdio.h:34:0,
from my_stack.c:2:
/usr/lib/gcc/i686-linux-gnu/4.7/include/stddef.h:213:9: error: expected ‘;’, identifier or ‘(’ before ‘unsigned’
In file included from /usr/include/stdio.h:75:0,
from my_stack.c:2:
/usr/include/libio.h:334:3: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:366:62: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:375:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:497:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from my_stack.c:2:0:
/usr/include/stdio.h:320:35: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:326:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:338:20: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:345:10: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:387:44: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:391:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:663:11: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:666:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:676:8: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:706:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:712:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:734:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:736:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:140:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__ctype_get_mb_cur_max’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:337:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:367:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:471:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:485:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/include/stdlib.h:497:0,
from my_stack.c:3:
/usr/include/alloca.h:33:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:503:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:65: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:25: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:34: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:50: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:840:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:843:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:847:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:851:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:860:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:864:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:871:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mbstowcs’
/usr/include/stdlib.h:874:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘wcstombs’
my_stack.c: In function ‘CreateStack’:
my_stack.c:24:16: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
错误解决方式:
将.c文件中的系统头文件放在自己写的头文件前边就可以了
2、错误提示:
hangma@ubuntu:~/test/test/protest/stack_test$ gcc -c my_stack.c -o my_stack.o
my_stack.c:7:1: error: expected ‘;’, identifier or ‘(’ before ‘int’
错误解决:在我的头文件中,定义的结构体最后忘记加分号了
hangma@ubuntu:~/test/test/protest/stack_test$ gcc -c my_stack.c -o my_stack.o
In file included from /usr/include/stdio.h:34:0,
from my_stack.c:2:
/usr/lib/gcc/i686-linux-gnu/4.7/include/stddef.h:213:9: error: expected ‘;’, identifier or ‘(’ before ‘unsigned’
In file included from /usr/include/stdio.h:75:0,
from my_stack.c:2:
/usr/include/libio.h:334:3: error: expected specifier-qualifier-list before ‘size_t’
/usr/include/libio.h:366:62: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:375:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/libio.h:497:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_IO_sgetn’
In file included from my_stack.c:2:0:
/usr/include/stdio.h:320:35: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:326:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:338:20: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:345:10: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:387:44: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:391:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:663:11: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:666:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:676:8: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdio.h:706:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread’
/usr/include/stdio.h:712:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite’
/usr/include/stdio.h:734:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fread_unlocked’
/usr/include/stdio.h:736:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘fwrite_unlocked’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:140:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__ctype_get_mb_cur_max’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:337:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:367:4: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:471:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:473:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:485:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from /usr/include/stdlib.h:497:0,
from my_stack.c:3:
/usr/include/alloca.h:33:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from my_stack.c:3:0:
/usr/include/stdlib.h:503:22: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:45: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:508:65: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:9: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:756:25: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:34: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:761:50: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:840:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:843:6: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:847:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:851:31: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:860:38: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:864:36: error: expected declaration specifiers or ‘...’ before ‘size_t’
/usr/include/stdlib.h:871:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘mbstowcs’
/usr/include/stdlib.h:874:15: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘wcstombs’
my_stack.c: In function ‘CreateStack’:
my_stack.c:24:16: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
错误解决方式:
将.c文件中的系统头文件放在自己写的头文件前边就可以了
2、错误提示:
hangma@ubuntu:~/test/test/protest/stack_test$ gcc -c my_stack.c -o my_stack.o
my_stack.c:7:1: error: expected ‘;’, identifier or ‘(’ before ‘int’
错误解决:在我的头文件中,定义的结构体最后忘记加分号了
相关文章推荐
- ubuntu下编译时遇到的错误及解决方式
- Ubuntu10.10 编译Android2.3源码时遇到的错误和解决办法
- ubuntu16.04 编译android6.0遇到的两个错误解决办法
- Ubuntu10.04 LTS 64位编译android4.1.2_r1遇到的错误及解决方法
- ubuntu 11.10 编译Android4.0.3时遇到的错误解决
- ubuntu10.10下编译android 2.3遇到的错误及解决方法
- ubuntu 编译时遇到 cannot find -lncurses 使用 解决办法
- ubuntu环境中搭建java开发环境(含遇到的错误及解决办法)
- ubuntu系统 编译libxml2的库是遇到如下错误
- Osmocombb项目编译GnuArmToolchain中的GCC4.5.2时遇到recipe for target 'doc/cpp.info' failed(texinfo)错误的解决方法
- ubuntu 编译 Android 出现的若干错误及解决方法
- ubuntu1404下安装caffe及配置python接口pycaffe遇到的各种错误的解决方法
- 在Ubuntu 下编译Liunx内核出现 Can't use 'defined(@array)' 错误的解决办法
- Ubuntu16.04+anaconda2+caffe+ssd+opencv3.1.0在编译caffe过程中的问题及解决方法 主要遇到三个问题,前两个是caffe在cmake过程中的问题,后一
- 【已解决】安装Ubuntu时怎样分区--利用EasyBCD在win7下进行ubuntu安装(双系统)时遇到报错:没有根文件系统,请回到分区菜单以修正此错误
- python中遇到的小错误解决方式
- vmware安装ubuntu13版本的vm tools时遇到的错误解决
- spark 编译遇到的错误及解决办法(一)
- 在vc++2008 编译过程中遇到 fatal error CVT1100 错误的解决方法
- 解决AndroidStudio添加ProjectLibary后在编译时遇到的各种问题之解决方式索引(finished with non-zero exit value and so on...)