Search code examples
c++visual-studio-2019packet-snifferslibtins

How to add macro Visual Studio 2019


I was trying to make a program to sniff packets and went to 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

What does it mean? It even does not have a value. Can some one help me how to add this in visual studio?

Does it mean something like

#define TINS_STATIC

Solution

  • See this answer for a full guide for using libtins with Visual Studio.

    Using #define TINS_STATIC (before including any libtins headers) would work. Alternatively you could add TINS_STATIC in the project settings under C/C++ > Preprocessor > Preprocessor definitions.

    It does not need to have a value, because the libtins header only checks if the symbol is defined, not what value it has (reference):

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