-1
我試圖在Linux上使用GNU編譯器使用下面的Makefile錯誤:升壓/ regex.hpp:沒有這樣的文件或目錄
CXX=gcc #icpc
RM=rm -f
CPPFLAGS=-g -O3 -fopenmp
CFLAGS= -Wall -c
OPENMP = -fopenmp
BIN = theVeecode_$(CXX)
LIBS= -L /path-to-boost/boost_1_53_0/stage/lib/ -lboost_regex
CPPSRCS=mathtools.cpp time_.cpp read_input.cpp vee_ao_calc.cpp vee_mo_calc.cpp write_int2e.cpp memory_check.cpp
OBJS=$(subst .cpp,.o,$(CPPSRCS))
OBJS+=$(COBJS)
all: $(BIN)
$(BIN): $(OBJS)
$(CXX) main.cpp $(OPENMP) -o $(BIN) $(OBJS) $(LIBS)
clean:
$(RM) $(OBJS) $(BIN)
dist-clean: clean
$(RM) $(BIN)
當我運行make命令來編譯我的C++代碼,我得到以下錯誤消息:
gcc -g -O3 -fopenmp -c -o read_input.o read_input.cpp
read_input.cpp:9:27: error: boost/regex.hpp: No such file or directory
read_input.cpp: In function 'void input::read_n_occ()':
read_input.cpp:95: error: 'boost' has not been declared
read_input.cpp:95: error: 'regex_search' was not declared in this scope
make: *** [read_input.o] Error 1
的read_input.cpp文件開頭
#... // other includes
#include <boost/regex.hpp>
using namespace std;
namespace xxx
{
//some code here
}
庫路徑「/ p ath-to-boost/boost_1_53_0/stage/lib /「包含文件 libboost_regex.a,libboost_regex.so和libboost_regex.so.1.53.0。
我不明白爲什麼編譯器沒有找到庫文件。有沒有人有任何想法,爲什麼它不工作,以及如何解決它?
在此先感謝。
可能會錯過提升包括目錄? – P0W
是的,你是對的。我很困惑,因爲我之前在另一臺機器上編譯了相同的Makefile代碼,所以我不清楚它爲什麼不起作用。無論如何,它現在工作。 – user3244013