windows 日食提升
Boost on eclipse on windows
我在 win 7 上使用 eclipse luna。
这是我的程序。
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main(int argc, char* argv[]){
// All programs that use asio need to have at least one io_service object
boost::asio::io_service io;
// sets the timer to expire 5 seconds from now
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
std::cout << "Hello, world!\n";
return 0;
}
这是我的命令行代码
g++ -I"C:\Users\Documents\Lib\boost_1_57_0\boost_1_57_0" -O0 -g3 -Wall -c -fmessage-length=0 -lboost_filesystem -lboost_system -lboost_libraryname -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Invoking: Cross G++ Linker
g++ -o "002_TimerSynchronously" ./main.o
错误
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
有人知道怎么解决吗?
非常感谢
参考:
undefined reference to boost::system::system_category() when compiling
How do I troubleshoot boost library/header inclusion via autoconf/automake?
发生链接时,库应该出现在第二个命令行中。也请注意并在目标文件之后列出库。
我在 win 7 上使用 eclipse luna。
这是我的程序。
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
int main(int argc, char* argv[]){
// All programs that use asio need to have at least one io_service object
boost::asio::io_service io;
// sets the timer to expire 5 seconds from now
boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
t.wait();
std::cout << "Hello, world!\n";
return 0;
}
这是我的命令行代码
g++ -I"C:\Users\Documents\Lib\boost_1_57_0\boost_1_57_0" -O0 -g3 -Wall -c -fmessage-length=0 -lboost_filesystem -lboost_system -lboost_libraryname -MMD -MP -MF"main.d" -MT"main.d" -o "main.o" "../main.cpp"
Invoking: Cross G++ Linker
g++ -o "002_TimerSynchronously" ./main.o
错误
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:221: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
C:/Users/SulfredLee/Documents/Lib/boost_1_57_0/boost_1_57_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::system_category()'
有人知道怎么解决吗?
非常感谢
参考:
undefined reference to boost::system::system_category() when compiling
How do I troubleshoot boost library/header inclusion via autoconf/automake?
发生链接时,库应该出现在第二个命令行中。也请注意并在目标文件之后列出库。