0
工作,我現在用的是以下結構在Makefile:Make文件不是爲升壓
OBJECTS := time.o
PROGRAM := time
CPPFLAGS += -Iusr/include/boost_1_49_0 -Lusr/include/boost_1_49_0/stage/lib
CXXFLAGS := -Wall -ggdb3
LDFLAGS += -lboost_date_time
$(PROGRAM) : $(OBJECTS)
g++ -o time time.cpp
clean :
rm $(PROGRAM) $(OBJECTS)
但是,當我進入做,它給了我很多的錯誤 - 包括:
undefined reference to `boost::gregorian::greg_month::as_short_string() const' time.cpp:
(.text._ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_13simple_formatIcEEcE12format_monthERKS3_RSo[boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::basic_ostream<char, std::char_traits<char> >&)]+0x56):
undefined reference to `boost::gregorian::greg_month::as_long_string() const'
collect2: ld returned 1 exit status
當我使用g++ -Wall -Iusr/include/boost_1_49_0 -Lusr/include/boost_1_49_0/stage/lib -o time time.cpp -lboost_date_time
,代碼編譯得很好,所以我的Makefile有些問題。請幫忙。注意:我嘗試將-L <directory>
標誌置於LDFLAG
變量中,但這也不起作用。