Boost in Visual Studio 2010, IntelliSense error

2019-06-23 14:56发布

I would like to see if you could orient me.

It happens that I compiled and referenced the boost libraries in order to use them with Visual Studio 2010. When building my test project I get these two IntelliSense errors

1   IntelliSense: #error directive: "Macro BOOST_LIB_NAME not set (internal error)" c:\boost_1_43_0\boost\config\auto_link.hpp

2   IntelliSense: #error directive: "some required macros where not defined (internal logic error)."    c:\boost_1_43_0\boost\config\auto_link.hpp

Checking the auto_link.hpp header file the first error is in this line

#ifndef BOOST_LIB_NAME
#  error "Macro BOOST_LIB_NAME not set (internal error)"
#endif

Tracing the definition of BOOST_LIB_NAME, it seems that is defined in config.hpp by boost_regex, which code I am including below

#if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
#  define BOOST_LIB_NAME boost_regex
#  if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
#     define BOOST_DYN_LINK
... more code

and strangely when I point to BOOST_LIB_NAME it defines BOOST_LIB_NAME and the IntelliSense errors disappear.

My program builds and executes fine using the Boost:Regex library -- with or without the Intellisense errors; however, I do not understand why these IntelliSense errors appear in the first place, and second why pointing the macro in the config.hpp defines BOOST_LIB_NAME.

Any guidance will be greatly appreciated.

Thanks,

Jaime

1条回答
Lonely孤独者°
2楼-- · 2019-06-23 15:30

The Visual Studio IntelliSense error checking for C++ is not perfect and often reports errors that aren't really errors (those are links to three false positives that I've found and reported; they aren't related to your problem, though).

查看更多
登录 后发表回答