모든,Crosscompiling C 나는 리눅스 플랫폼에서 일부 크로스 컴파일을 수행 할 mingw32 툴 체인을 사용하고
컴파일러 오류가 리눅스에 창문합니다. 내가 표준 라이브러리에서 <error.h>
을 포함하기 전까지는 모든 것이 잘 진행되었다. 이제 mingw32는 error.h
을 찾을 수 없다는 컴파일러 오류를 발생시킵니다.
이것은 GNU 확장이지만 GNU getopts.h
도 사용하고 있습니다. 그렇다면이 문제는 왜 발생합니까? 다음은 상세 출력이다
[09:57:48]$ i586-mingw32msvc-gcc scanner.c -O -Wall -o brookfieldSplitter.exe -v 2>&1 | sed ':1;s,/[^/.][^/]*/\\.\\./,/,;t 1'
Using built-in specs.
Target: i586-mingw32msvc
Configured with: /build/buildd/mingw32-4.2.1.dfsg/build_dir/src/gcc-4.2.1-2-dfsg/configure -v --prefix=/usr --target=i586-mingw32msvc --enable-languages=c,c++ --enable-threads --enable-sjlj-exceptions --disable-multilib --enable-version-specific-runtime-libs
Thread model: win32
gcc version 4.2.1-sjlj (mingw32-2)
/usr/libexec/gcc/i586-mingw32msvc/4.2.1-sjlj/cc1 -quiet -v scanner.c -quiet -dumpbase scanner.c -mtune=pentium -auxbase scanner -O -Wall -version -o /tmp/cc4itePc.s
ignoring nonexistent directory "/usr/i586-mingw32msvc/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/include
/usr/i586-mingw32msvc/include
End of search list.
GNU C version 4.2.1-sjlj (mingw32-2) (i586-mingw32msvc)
compiled by GNU C version 4.4.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 593b76e6db3b48c579d5ccd7737af5b4
scanner.l:53:19: error: error.h: No such file or directory
scanner.l: In function 'main':
scanner.l:638: warning: implicit declaration of function 'error'
이 mingw32 wiki page에 언급 한 바와 같이, GCC와 mingw32위한 검색 경로 차이들이있다. 위 출력에서 #include
항목을 검색하는 곳을 볼 수 있습니다. 요청에 따라 locate error.h
의
내용 :
[10:44:42]$ locate error.h
/usr/i586-mingw32msvc/include/raserror.h
/usr/i586-mingw32msvc/include/winerror.h
/usr/include/error.h
/usr/include/glib-2.0/gio/gdbuserror.h
/usr/include/glib-2.0/gio/gioerror.h
/usr/include/glib-2.0/glib/gerror.h
/usr/include/i386-linux-gnu/bits/error.h
/usr/include/linux/can/error.h
/usr/lib/syslinux/com32/include/gplinclude/disk/error.h
/usr/share/doc/ipython/manual/html/api/generated/IPython.kernel.core.error.html
/usr/share/doc/ipython/manual/html/api/generated/IPython.kernel.error.html
/usr/share/pgadmin3/docs/cs_CZ/connect-error.html
/usr/share/pgadmin3/docs/en_US/connect-error.html
/usr/share/pgadmin3/docs/fr_FR/connect-error.html
/usr/share/webkitgtk-1.0/webkit-1.0/resources/error.html
/usr/share/webkitgtk-3.0/webkit-3.0/resources/error.html
/usr/src/linux-headers-3.0.0-12/arch/ia64/sn/include/ioerror.h
/usr/src/linux-headers-3.0.0-12/arch/mips/include/asm/fw/cfe/cfe_error.h
/usr/src/linux-headers-3.0.0-12/include/linux/can/error.h
/usr/src/linux-headers-3.0.0-12-generic/include/config/ata/verbose/error.h
왜 mingw32는 GNU 확장
아래 Ignacio에서 언급했듯이 getopt는 POSIX입니다. 그리고이 문제를 해결하는 가장 쉬운 방법은 무엇입니까?getopt
하지만
error
포함되어 있습니까?
- ISO C로 삭제 하시겠습니까?
- 컴파일러의 검색 경로에/usr/include를 추가 하시겠습니까?
error
을/usr/i586-mingw32msvc/include /에 복사하십시오. 이 글을 쓰는 시점에서 마지막 코멘트에 링크로
** 링커 ** 오류는 전혀 보이지 않습니다. 'locate error.h '를 시도해보십시오. GCC를 가리키는 곳에 파일이 있습니까? – 0xC0000022L
"오류를 찾을 수 없습니다."는 링커 오류가 아닌 컴파일러 오류입니다. 아, 표준 C 라이브러리에는'error.h '가 없습니다. 'errno.h '를 의미 했습니까? – cHao
크로스 컴파일러의 include 디렉토리에'error.h'가 있습니까? –