मैं बूस्ट सीख रहा हूं और मेरी फाइलों के साथ परेशानी हो रही है।फाइल बनाने में बढ़ावा पुस्तकालयों सहित
accesstimer: acctime.o btimer.o
g++ acctime.o btimer.o -o accesstimer
acctime.o: acctime.cpp btimer.h
g++ -c acctime.cpp
bentimer.o: btimer.cpp btimer.h
g++ -c btimer.cpp
जब acctime.cpp इस मीटर में कोई बढ़ावा फाइल सिस्टम तत्व है, शॉट लें फ़ाइल ठीक काम करता है: यहाँ मेरी बुनियादी makefile है। जैसे ही मैं बूस्ट फाइल सिस्टम तत्वों को जोड़ता हूं, मुझे स्पष्ट रूप से मेक फ़ाइल में बूस्ट लाइबेरे के संदर्भों की आवश्यकता होती है, जहां मुझे समस्याएं आ रही हैं।
निम्न पंक्ति एक एकल फाइल संकलन के लिए काम करता है:
g++ -I /usr/local/boost/boost_1_39_0 boosttest1.cpp -o bt1 /usr/local/boost/boost_1_39_0/stage/lib/libboost_filesystem-gcc41-mt.a /usr/local/boost/boost_1_39_0/stage/lib/libboost_system-gcc41-mt.a
अब मैं कर फाइल में इस एकीकृत करने के लिए कोशिश कर रहा हूँ। मैं कई की कोशिश की है क्या जानकारी मैं वेब पर मिल सकता है के आधार पर, लेकिन कोई भी काम कर रहे हैं यह मेरी नवीनतम है:
accesstimer: acctime.o bentimer.o
g++ acctime.o bentimer.o -o accesstimer
acctime.o: acctime.cpp bentimer.h
g++ -c -I /usr/local/boost/boost_1_39_0 acctime.cpp /usr/local/boost/boost_1_39_0/stage/lib/libboost_filesystem-gcc41-mt.a /usr/local/boost/boost_1_39_0/stage/lib/libboost_system-gcc41-mt.a
bentimer.o: bentimer.cpp bentimer.h
g++ -c bentimer.cpp
दुर्भाग्य से यह stlill नहीं बूस्ट पुस्तकालयों पा सकते हैं, किसी को भी मदद कर सकते हैं? धन्यवाद
लोग हैं, जो उत्तर दिया है मैं अब इस मिल गया है की सलाह को पढ़ने के बाद:
accesstimer: acctime.o bentimer.o
g++ -L /usr/local/boost/boost_1_39_0 acctime.o /usr/local/boost/boost_1_39_0/stage/lib/libboost_filesystem-gcc41-mt.a /usr/local/boost/boost_1_39_0/stage/lib/libboost_system-gcc41-mt.a bentimer.o -o accesstimer
acctime.o: acctime.cpp bentimer.h
g++ -c acctime.cpp
bentimer.o: bentimer.cpp bentimer.h
g++ -c bentimer.cpp
लेकिन यह अभी भी लिंक करने के लिए विफल रहता है।
यह मैं हो रही है त्रुटि संदेश है: (! धन्यवाद बहुत सराहना)
g++ -L /usr/local/boost/boost_1_39_0/stage/lib/libboost_filesystem-gcc41-mt.a /usr/local/boost/boost_1_39_0/stage/lib/libboost_system-gcc41-mt.a acctime.o bentimer.o -o accesstimer
acctime.o: In function boost::enable_if<boost::filesystem::is_basic_path<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >, bool>::type boost::filesystem::exists<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >(boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> const&)':
acctime.cpp:(.text._ZN5boost10filesystem6existsINS0_10basic_pathISsNS0_11path_traitsEEEEENS_9enable_ifINS0_13is_basic_pathIT_EEbE4typeERKS7_[boost::enable_if<boost::filesystem::is_basic_path<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >, bool>::type boost::filesystem::exists<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >(boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> const&)]+0x26): undefined reference to `boost::filesystem::detail::status_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int&)'
collect2: ld returned 1 exit status
make: *** [accesstimer] Error 1
बाद orsogufo की सलाह अब यह है:
accesstimer: acctime.o bentimer.o
g++ -L/usr/local/boost/boost_1_39_0/stage/lib -llibboost_filesystem-gcc41-mt.a -llibboost_system-gcc41-mt.a acctime.o bentimer.o -o accesstimer
acctime.o: acctime.cpp bentimer.h
g++ -c acctime.cpp
bentimer.o: bentimer.cpp bentimer.h
g++ -c bentimer.cpp
बेहतर खोज रहे हैं, लेकिन अभी भी नहीं कर सकते हैं काफी लाइब्रेरी पाएं:
g++ -L/usr/local/boost/boost_1_39_0/stage/lib -llibboost_filesystem-gcc41-mt.a -llibboost_system-gcc41-mt.a acctime.o bentimer.o -o accesstimer
/usr/bin/ld: cannot find -llibboost_filesystem-gcc41-mt.a
collect2: ld returned 1 exit status
make: *** [accesstimer] Error 1
मैंने उस स्थान को दो बार चेक किया है और लाइब्रेरी निश्चित रूप से है: /usr/local/boost/boost_1_39_0/stage/lib/libboost_filesystem-gcc41-mt.a
अभी भी कोई खुशी, अब यह usimg:
accesstimer: acctime.o bentimer.o
g++ -L/usr/local/boost/boost_1_39_0 -lboost_filesystem-gcc41-mt acctime.o bentimer.o -o accesstimer
acctime.o: acctime.cpp bentimer.h
g++ -I /usr/local/boost/boost_1_39_0 -c acctime.cpp
bentimer.o: bentimer.cpp bentimer.h
g++ -c bentimer.cpp
हो रही है:
g++ -L/usr/local/boost/boost_1_39_0/stage/lib/ -llibboost_filesystem-gcc41-mt acctime.o bentimer.o -o accesstimer
/usr/bin/ld: cannot find -llibboost_filesystem-gcc41-mt
collect2: ld returned 1 exit status
make: *** [accesstimer] Error 1
यह इस के साथ काम:
accesstimer: acctime.o bentimer.o
g++ -L/usr/local/boost/boost_1_39_0/stage/lib -lboost_filesystem acctime.o bentimer.o -o accesstimer
acctime.o: acctime.cpp bentimer.h
g++ -I /usr/local/boost/boost_1_39_0 -c acctime.cpp
bentimer.o: bentimer.cpp bentimer.h
g++ -c bentimer.cpp
अपने सभी मदद के लिए धन्यवाद
आपको प्राप्त हो रहे त्रुटि संदेश पोस्ट कर सकते हैं? –
जब आप -एल ध्वज के साथ पुस्तकालयों को लिंक करते हैं, तो आप हमेशा अग्रणी "lib" छोड़ देते हैं। तो libm.a को जोड़ना -lm है, libboost is -lboost, आदि है। –