我尝试编译一个包含<regex.h>
和i586-mingw32msvc-gcc
的源文件:
$ i586-mingw32msvc-gcc parser.c -Ilibregex/include -o parser.o
我明白了:
/tmp/ccPpDhjW.o:parser.c:(.text+0xfd): undefined reference to `__imp__regcomp'
/tmp/ccPpDhjW.o:parser.c:(.text+0x144): undefined reference to `__imp__regexec'
/tmp/ccPpDhjW.o:parser.c:(.text+0x158): undefined reference to `__imp__regfree'
/tmp/ccPpDhjW.o:parser.c:(.text+0x18f): undefined reference to `__imp__regcomp'
/tmp/ccPpDhjW.o:parser.c:(.text+0x1b8): undefined reference to `__imp__regerror'
/tmp/ccPpDhjW.o:parser.c:(.text+0x1fc): undefined reference to `__imp__regexec'
/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/../../../../i586-mingw32msvc/lib/libmingw32.a(main.o):(.text+0x85): undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
我的文件夹libregex/include
包含regex.h
。
是否有人尝试在交叉编译中编译包含<regex.h>
mingw
的来源?
答案 0 :(得分:0)
尝试在添加#define PCRE_STATIC
之前添加pcreposix.h
。
答案 1 :(得分:0)
添加-lregex
可以与msys2 w64-x86_64