I am trying to list items in the current directory using boost::filesystem
but I get:
Unhandled exception at 0x6B59DF8D (msvcr110.dll) in BoostTest.exe: 0xC0000005: Access violation reading location 0x9BE3B7A1.
Here is my code:
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main() {
std::cout << "Hello World!\n";
auto end_it = directory_iterator();
for(auto it = directory_iterator(current_path()); it != end_it; it++) {
std::cout << it->path() << std::endl;
}
std::cin.get();
return 0;
}
I have just switched over to vs2012 from mingw and I think it could be a linking error or something like that. I'm linking with these 32 bit libraries:
- boost_filesystem-vc110-mt-1_52.lib
And these files are in the directory of the executable:
- boost_filesystem-vc110-mt-1_52.dll
- boost_system-vc110-mt-1_52.dll
downloaded from this website: http://boost.teeks99.com/
and the platform is set to "Win32".
Here is the log from the Visual Studio 2012 window:
'BoostTest.exe' (Win32): Loaded 'C:\Users\Ell\Programming\C++\BoostTest\Debug\BoostTest.exe'. Symbols loaded.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Users\Ell\Programming\C++\BoostTest\Debug\boost_filesystem-vc110-mt-1_52.dll'. Module was built without symbols.
'BoostTest.exe' (Win32): Loaded 'C:\Users\Ell\Programming\C++\BoostTest\Debug\boost_system-vc110-mt-1_52.dll'. Module was built without symbols.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110.dll'. Symbols loaded.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110.dll'. Symbols loaded.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'BoostTest.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
First-chance exception at 0x6B59DF8D (msvcr110.dll) in BoostTest.exe: 0xC0000005: Access violation reading location 0x9BF7B7A1.
Unhandled exception at 0x6B59DF8D (msvcr110.dll) in BoostTest.exe: 0xC0000005: Access violation reading location 0x9BF7B7A1.
The program '[5292] BoostTest.exe' has exited with code 0 (0x0).
My platform is windows 7 64 bit with visual studio 2012 64 bit compiler.
I have only ever developed on linux and mingw so it is likely me linking something incorrectly or something like that - maybe architecture problems (although I was under the impressions 32 bit applications used 32 bit libraries). Any help appreciated!