title: \mingw-w64\ ... \ld.exe: cannot find -lboost_filesystem
body: <p>I'm trying to compile simple c++ program with mingw on "windows 7 64bit" command prompt. Error I get is:</p>
  
  <pre><code>&gt;gcc fs.cpp -lboost_filesystem -lboost_system
  c:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_filesystem
  c:/Program Files/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lboost_system
  collect2.exe: error: ld returned 1 exit status
  </code></pre>
  
  <p>Maybe useful system variable information:</p>
  
  <pre><code>c:\Boost\lib&gt;echo %path%
  C:\Boost\boost-build\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Skype\Phone\;c:\Program Files\mingw-w64\x86_64-8.1.0-win32-seh-rt_v6-rev0\mingw64\bin\;c:\Boost\lib\
  
  c:\Boost\lib&gt;echo %library_path%
  c:\Boost\lib
  
  c:\Boost\lib&gt;echo %cplus_include_path%
  c:\Boost\include\
  </code></pre>
  
  <p>and a content of boost/lib is:</p>
  
  <pre><code>c:\Boost\lib&gt;dir
   Volume in drive C is Acer
   Volume Serial Number is 62C5-4B7E
  
   Directory of c:\Boost\lib
  
  13.06.2019.  00:31    &lt;DIR&gt;          .
  13.06.2019.  00:31    &lt;DIR&gt;          ..
  13.06.2019.  00:28         5.608.426 libboost_filesystem-mgw81-mt-d-x32-1_70
  13.06.2019.  00:28         6.553.512 libboost_filesystem-mgw81-mt-d-x64-1_70
  13.06.2019.  00:28         3.713.979 libboost_filesystem-mgw81-mt-d-x64-1_70
  13.06.2019.  00:28            92.342 libboost_filesystem-mgw81-mt-d-x64-1_70
  13.06.2019.  00:28           344.104 libboost_filesystem-mgw81-mt-s-x32-1_70
  13.06.2019.  00:28           405.348 libboost_filesystem-mgw81-mt-s-x64-1_70
  13.06.2019.  00:28         5.608.426 libboost_filesystem-mgw81-mt-sd-x32-1_7
  13.06.2019.  00:28         6.553.512 libboost_filesystem-mgw81-mt-sd-x64-1_7
  13.06.2019.  00:28           344.104 libboost_filesystem-mgw81-mt-x32-1_70.a
  13.06.2019.  00:28           405.348 libboost_filesystem-mgw81-mt-x64-1_70.a
  13.06.2019.  00:28           239.395 libboost_filesystem-mgw81-mt-x64-1_70.d
  13.06.2019.  00:28            92.132 libboost_filesystem-mgw81-mt-x64-1_70.d
  13.06.2019.  00:28             2.822 libboost_system-mgw81-mt-d-x32-1_70.a
  13.06.2019.  00:28             3.118 libboost_system-mgw81-mt-d-x64-1_70.a
  13.06.2019.  00:28            49.550 libboost_system-mgw81-mt-d-x64-1_70.dll
  13.06.2019.  00:28             1.772 libboost_system-mgw81-mt-d-x64-1_70.dll
  13.06.2019.  00:28               730 libboost_system-mgw81-mt-s-x32-1_70.a
  13.06.2019.  00:28               924 libboost_system-mgw81-mt-s-x64-1_70.a
  13.06.2019.  00:28             2.822 libboost_system-mgw81-mt-sd-x32-1_70.a
  13.06.2019.  00:28             3.118 libboost_system-mgw81-mt-sd-x64-1_70.a
  13.06.2019.  00:28               730 libboost_system-mgw81-mt-x32-1_70.a
  13.06.2019.  00:28               924 libboost_system-mgw81-mt-x64-1_70.a
  13.06.2019.  00:28            47.834 libboost_system-mgw81-mt-x64-1_70.dll
  13.06.2019.  00:28             1.760 libboost_system-mgw81-mt-x64-1_70.dll.a
  </code></pre>
  
  <p>I've tried to include path manually with </p>
  
  <pre><code>gcc fs.cpp -o fs.exe -Lc:\Boost\lib -lboost_filesystem -lboost_system
  </code></pre>
  
  <p>or with</p>
  
  <pre><code>gcc fs.cpp -o fs.exe -L c:\Boost\lib -lboost_filesystem -lboost_system
  </code></pre>
  
  <p>or with</p>
  
  <pre><code>gcc fs.cpp -o fs.exe -L c:\Boost\lib -llibboost_filesystem -llibboost_system
  </code></pre>
  
  <p>and gotthe same output.</p>
  
  <p>To me it looks like a linker problem. But, I'm not experienced. Could this be a product of badly compiled library files?</p>
  
  <p>What options should I use when compiling c++ on Windows? Where did I go wrong?</p>