开发者

Why Visual Studio cannot find 'tr1/unordered_map?

开发者 https://www.devze.com 2023-02-16 18:31 出处:网络
I want to use google-ctemplate in a project. But if I include the basic file, I get the following error (with Visual Studio C++ 2005):

I want to use google-ctemplate in a project. But if I include the basic file, I get the following error (with Visual Studio C++ 2005):

Error   1   fatal error C1083: Cannot open include file: 'tr1/unordere开发者_JAVA百科d_map': No such file or directory f:\entwicklung\libraries\ctemplate-0.99\src\ctemplate\template_cache.h  39

I can find the unordered_map.hpp in the boost-directory and the boost-directory is set in the include-path in Visual Studio. How can I solve this problem?


I found out what the problem was. I included the wrong directory from google-ctemplate. Instead of src I have to use src/windows.

But that triggers another Problem, this time from the linker.


As is, you can use:

#include <boost/tr1/unordered_map.hpp>

Alternatively, add your $(boost-directory)/boost/tr1/tr1 to the include path and use:

#include <unordered_map>

See this Header Include Style for more details.

Note: I'm assuming $(boost-directory) is set to something like "C:\boost_1_46_0".


Considering that TR1 was not published until the summer of 2005, I wouldn't be surprised that it isn't present in VS 2005. You might try a more up-to-date version of the compiler!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号