title: Linking error when using the NetCDF C library
body: <p>I need to work with the NetCDF Format in C++ (I use Visual Studio as an IDE) and the C++ interface seems to be problematic, so I want to use the C Library as it is avaiable as a prebuilt library:</p>
  <p><a href="https://www.unidata.ucar.edu/software/netcdf/docs/winbin.html" rel="nofollow noreferrer">https://www.unidata.ucar.edu/software/netcdf/docs/winbin.html</a></p>
  <p>I used the NetCDF-4 32-bit Version. Now I have my .nc files saved in some folder and want to open these with the method ncopen as below:</p>
  <pre><code>#include&lt;netcdf.h&gt;
  #include&lt;string&gt;
  #include&lt;iostream&gt;
  
  using namespace std;
  int main() {
      const char* pathPointer = &quot;foo&quot;;
      int ncid;
      int status;
      status = nc_open(pathPointer, NC_NOWRITE, &amp;ncid); 
      return 0;
  }
  </code></pre>
  <p>But now, I get the following errors:</p>
  <p>LNK2019 unresolved external symbol _nc_open referenced in function _main    NetCDFtest  C:\Users\Marcel\Documents\Visual Studio 2019\Projects\NetCDFtest\NetCDFtest\Quelle.obj  1</p>
  <p>LNK1120 1 unresolved externals  NetCDFtest  C:\Users\Marcel\Documents\Visual Studio 2019\Projects\NetCDFtest\Debug\NetCDFtest.exe   1</p>
  <p>I think that I linked everything properly, I tried it as in the answer of the following post:</p>
  <p><a href="https://stackoverflow.com/questions/34331969/visual-studio-adding-netcdf-library">Visual Studio - adding netCDF library</a></p>
  <p>So, I do not know what the problem could be. As it is a C library, I tried to use extern &quot;C&quot; {} around the include part as below:</p>
  <pre><code>#extern &quot;C&quot; {
   #include&lt;netcdf.h&gt; 
  }
  </code></pre>
  <p>However, I get the same errors as above. Does anyone have an idea?</p>