Netbeans给出了对PCRE函数的未定义引用

问题描述:

当我尝试构建程序时,链接程序失败,告诉我有未定义的对PCRE函数的引用。 我已经链接libpcre.a,并将它所在的目录添加到搜索路径中,并将头文件添加到搜索路径中,甚至通过配置cmake重新创建PCRE几次,以防万一以及关闭PCRECPP在目录上运行make。看来我无法做任何事情来解决它,我相信这是一个配置问题。它可能是我在我身上做的傻事!Netbeans给出了对PCRE函数的未定义引用

mkdir -p build/Debug/MinGW-Windows 
rm -f build/Debug/MinGW-Windows/main.o.d 
gcc.exe -c -g -Wall -I/C/Users/One/Documents/Programming/C/Libraries/pcre-8.12 -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.c 
main.c: In function 'main': 
main.c:278:5: warning: passing argument 3 of 'pcre_compile' from incompatible pointer type [enabled by default] 
c:/Users/One/Documents/Programming/C/Libraries/pcre-8.12/pcre.h:282:21: note: expected 'const char **' but argument is of type 'char **' 
main.c:282:5: warning: passing argument 3 of 'pcre_compile' from incompatible pointer type [enabled by default] 
c:/Users/One/Documents/Programming/C/Libraries/pcre-8.12/pcre.h:282:21: note: expected 'const char **' but argument is of type 'char **' 
main.c: In function 'getFileList': 
main.c:231:1: warning: control reaches end of non-void function [-Wreturn-type] 
main.c: In function 'getFileServer': 
main.c:205:1: warning: control reaches end of non-void function [-Wreturn-type] 
mkdir -p dist/Debug/MinGW-Windows 
gcc.exe  -o dist/Debug/MinGW-Windows/project1 build/Debug/MinGW-Windows/main.o -L/C/Users/One/Documents/Programming/C/Libraries/pcre-8.12/lib -lpcre 
build/Debug/MinGW-Windows/main.o: In function `runRegex': 
C:\Users\One\Documents\Programming\C\Projects\project1/main.c:174: undefined reference to `_imp__pcre_exec' 
build/Debug/MinGW-Windows/main.o: In function `main': 
C:\Users\One\Documents\Programming\C\Projects\project1/main.c:278: undefined reference to `_imp__pcre_compile' 
C:\Users\One\Documents\Programming\C\Projects\project1/main.c:282: undefined reference to `_imp__pcre_compile' 
collect2: ld returned 1 exit status 

出于某种原因,编译器期待动态库 - 一旦我在CMake中设置选项,它工作正常。 (虽然我仍然不知道如何让它接受构建的静态库,尽管我可以通过命令行使用gcc来完成)