我是新來推動的,並且認爲我會用.dll的一些實際的部署場景來嘗試它,所以我使用以下命令來編譯/安裝庫:在VS2005上使用「--layout = system」時出現boost鏈接錯誤
.\bjam install --layout=system variant=debug runtime-link=shared link=shared
--with-date_time --with-thread --with-regex --with-filesystem
--includedir=<my include directory> --libdir=<my bin directory> > installlog.txt
這似乎工作,但我的簡單的程序(從「入門」頁面右邊線)失敗:
#include <boost/regex.hpp>
#include <iostream>
#include <string>
// Place your functions after this line
int main()
{
std::string line;
boost::regex pat("^Subject: (Re: |Aw:)*(.*)");
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}
這失敗,出現以下鏈接錯誤:
fatal error LNK1104: cannot open file 'libboost_regex-vc80-mt-1_42.lib'
我確定.lib和.dll都在那個目錄下,並命名爲我希望它們是什麼(例如:boost_regex.lib等,所有未版本化,因爲--layout = system說)。那麼爲什麼要尋找它的版本類型呢?我怎樣才能找到它的未版本化的類型?
我已經試過這更「正常」的選項,如下面:
.\bjam stage --build-type=complete --with-date_time --with-thread --with-filesystem --with-regex > mybuildlog.txt
而且工作正常。我確信我的編譯器看到了「stage \ lib」目錄,它編譯並運行良好,除了讓環境查看正確的lib目錄之外沒有任何其他的東西。但是當我拿走那些「測試」目錄並想要使用這些其他(未版本控制)的目錄時,它就失敗了。
我在XP的VS2005下。有任何想法嗎?
工作,雖然現在我得到一個shared_ptr錯誤(一個BOOST_ASSERT失敗的空指針)。我甚至跨過了代碼,無法理解未初始化的東西。可能是因爲我編譯沒有這個標誌的庫,並且試圖用它來編譯應用程序,但是這仍然沒有多大意義。 無論如何,感謝您的幫助。 – 2010-03-17 14:53:45