C stdio编译错误问题解决及去掉^M符号

错误:
GNU C (Sourcery G++ Lite 2009q1-203) version 4.3.3 (arm-none-linux-gnueabi)
        compiled by GNU C version 4.3.2, GMP version 4.2.4, MPFR version 2.3.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ff2e25870db5a86cad0a49ae0451c7d1
In file included from /opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:75,
                 from client_sock.c:1:
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/libio.h:332: error: expected specifier-qualifier-list before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/libio.h:364: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/libio.h:373: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/libio.h:493: error: expected '=', ',', ';', 'asm' or '__attribute__' before '_IO_sgetn'
In file included from client_sock.c:1:
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:312: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:319: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:361: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:363: error: format string argument not a string type
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:365: error: expected declaration specifiers or '...' before 'size_t'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:367: error: format string argument not a string type
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:678: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:684: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:706: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fread_unlocked'
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdio.h:708: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'fwrite_unlocked'
In file included from client_sock.c:2:
/opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdlib.h:140: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__ctype_get_mb_cur_max'
In file included from /opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/sys/select.h:46,
                 from /opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/sys/types.h:220,
                 from /opt/arm-2009q1/arm-2009q1/bin/../arm-none-linux-gnueabi/libc/usr/include/stdlib.h:320,


原因: 代码中有不能识别的字符。如windows下编辑源文件,在Linux下出现^M符号。


去掉^M符号方法:


find -name \*h -exec sed -i 's/\r//g' {} \;



你可能感兴趣的:(IO)