无法将boost正则表达式链接到mingw
我的mingw编译器: 促进: (都在D:驱动器上) 代码: 在无法将boost正则表达式链接到mingw,boost,mingw,static-linking,Boost,Mingw,Static Linking,我的mingw编译器: 促进: (都在D:驱动器上) 代码: 在d:\boost\stage\lib目录中有libboost\u regex-mgw47-mt-1\u 52.a 该过程返回: d:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lboost_regex collect2.exe: error: ld returned 1 exit
d:\boost\stage\lib
目录中有libboost\u regex-mgw47-mt-1\u 52.a
该过程返回:
d:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lboost_regex
collect2.exe: error: ld returned 1 exit status
如果我输入*.a文件的确切名称,结果是找不到-llibboost_regex-mgw47-mt-1_52.a
即使是-ld:\boost\stage\lib\libboost\u regex-mgw47-mt-1\u 52的整个路径。a
也不起作用。我在-l
后面放的任何内容都具有相同的效果。如您所见,您必须使用(-l
,后跟删除库preffix和扩展名的库的名称a):
或(库的完整路径,不使用-l
):
PS:我个人做的一件事是使用--layout=taged
构建boost。这使得库的名称更易于管理(在本例中为libboost_regex-mt.a
)。如您所见,您必须使用其中一种(-l
,后跟库的名称,删除库的preffix和扩展名.a):
或(库的完整路径,不使用-l
):
PS:我个人做的一件事是使用--layout=taged
构建boost。这使得库的名称更易于管理(在本例中为libboost\u regex-mt.a
)
SET PATH=%PATH%;D:\mingw\bin;D:\mingw\include
g++ -I "d:\mingw\include" -I "d:\boost" -Os -s -o test.exe test.cpp -std=c++11 -static -L "D:\boost\stage\lib" -lboost_regex
d:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lboost_regex
collect2.exe: error: ld returned 1 exit status
g++ -I "d:\mingw\include" -I "d:\boost" -Os -s -o test.exe test.cpp -std=c++11 -static -L "D:\boost\stage\lib" -lboost_regex-mgw47-mt-1_52
g++ -I "d:\mingw\include" -I "d:\boost" -Os -s -o test.exe test.cpp -std=c++11 -static D:/boost/stage/lib/libboost_regex-mgw47-mt-1_52.a