当我在Visual Studio中构建C++项目并输出.exe文件时,它会创建我的项目的.lib和.exp文件,并且需要很长时间。我在stdafx.h(预编译头文件)的开头添加了_DO_NOT_EXPORT条件,以尝试跳过此步骤,但是每次构建结束仍然会创建.lib和.exp文件。我是否在正确的位置添加了条件?
就算不值得一提,你也可以禁用这个块
#if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__)
# if defined(__BORLANDC__)
# define BOOST_DLLEXPORT __export
# else
# define BOOST_DLLEXPORT __declspec(dllexport)
# endif
#elif ! defined(_WIN32) && ! defined(_WIN64)
# if defined(__MWERKS__)
# define BOOST_DLLEXPORT __declspec(dllexport)
# elif defined(__GNUC__) && (__GNUC__ >= 3)
# define BOOST_USED __attribute__ ((used))
# elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800)
# define BOOST_USED __attribute__ ((used))
# endif
#endif
在 Boost 的 serialization/force_include.hpp
中。
__declspec(dllexport)
属性,然后采取必要的措施确保编译器看不到它。但这并不总是可行的,因为可能不是你的代码。如果无法实现,只能表示一声“遗憾”。 - Hans Passant