如何添加宏 Visual Studio 2019

How to add macro Visual Studio 2019

我正在尝试编写一个程序来嗅探数据包并转到 libtins

If you are using a static build of libtins on Windows, then you have link your application with tins.lib. You also need to add this macro definition to your project: TINS_STATIC

这是什么意思?它甚至没有价值。有人可以帮我如何在 visual studio 中添加这个吗?

是不是有点像

#define TINS_STATIC

请参阅 this 答案以获取有关将 libtins 与 Visual Studio 结合使用的完整指南。

使用 #define TINS_STATIC(在包含任何 libtins headers 之前)会起作用。或者,您可以在 C/C++ > Preprocessor > Preprocessor definitions.

下的项目设置中添加 TINS_STATIC

它不需要有值,因为 libtins header 只检查符号是否被定义,而不是它有什么值 (reference):

// If libtins was built into a shared library
#if defined(_WIN32) && !defined(TINS_STATIC)
...
#endif // _WIN32 && !TINS_STATIC