MongoDB在MFC下使用C++驅動編譯錯誤的解決

今天使用MongoDB的C++驅動,在編譯鏈接的時候一直出現錯誤,顯示的string_data.h下93行max宏的問題,可視其自己並非調用max宏,而是調用css

std::numeric_limits<size_t>::max

這樣就是產生錯誤,經過搜索發現解決方法(參考網址:http://blog.chinaunix.net/uid-17102734-id-2830143.html),將該函數用括號括起來,避免windows定義的混淆,具體修改以下html

原始定義:windows

StringData substr( size_t pos, size_t n = std::numeric_limits<size_t>::max() ) const;

修改後定義:函數

StringData substr( size_t pos, size_t n = (std::numeric_limits<size_t>::max)() ) const;

注意添加的括號,這樣就能夠解決編譯問題了post

相關文章
相關標籤/搜索