title: libtins Sniffer undefined
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;tins/tins.h&gt;
  
  using namespace Tins;
  using namespace std;
  
  bool callback(const PDU&amp; pdu) {
      // Find the IP layer
      const IP&amp; ip = pdu.rfind_pdu&lt;IP&gt;();
      // Find the TCP layer
      const TCP&amp; tcp = pdu.rfind_pdu&lt;TCP&gt;();
      cout &lt;&lt; ip.src_addr() &lt;&lt; ":" &lt;&lt; tcp.sport() &lt;&lt; " -&gt; "
           &lt;&lt; ip.dst_addr() &lt;&lt; ":" &lt;&lt; tcp.dport() &lt;&lt; endl;
      return true;
  }
  
  int main() {
      Sniffer("eth0").sniff_loop(callback);
  }
  </code></pre>
  
  <p>I have the default code <code>libtins</code> gives you, but for some reason <code>Sniffer</code> is undefined. I have included all libs in my linker.</p>
  
  <p>Also it gives me the following error when I built:</p>
  
  <pre><code>-- Build started: Project: Packet Sniffing, Configuration: Debug x64 ------
  1&gt;Packet Sniffing.cpp
  1&gt;C:\Users\usr\Documents\Code\C++ Projects\static\libtins\include\tins\macros.h(37,10): fatal error C1083: Cannot open include file: 'tins/config.h': No such file or directory
  1&gt;Done building project "Packet Sniffing.vcxproj" -- FAILED.
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>I have checked and there is no file called <code>config.h</code> however there is one called <code>config.h.in</code>. When I removed <code>.in</code> it gave me another error:</p>
  
  <pre><code>1&gt;------ Build started: Project: Packet Sniffing, Configuration: Debug x64 ------
  1&gt;Packet Sniffing.cpp
  1&gt;C:\Users\usr\Documents\Code\C++ Projects\static\libtins\include\tins\config.h(5,1): fatal error C1021: invalid preprocessor command 'cmakedefine'
  1&gt;Done building project "Packet Sniffing.vcxproj" -- FAILED.
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>The only instruction I didn't understand on <a href="https://libtins.github.io/" rel="nofollow noreferrer">their website</a> is when they say</p>
  
  <blockquote>
    <p>You also need to add this macro definition to your project:</p>
    
    <p>TINS_STATIC</p>
  </blockquote>
  
  <p>I don't exactly know what this means so this might also be the issue.</p>
  
  <p>Thanks in advance!</p>