I’ve written some C++ code that works completely fine in WSL (also valgrind showed no free / delete mismatches and also no leaked memory), but the same program compiled in CygWin leads to segmentation fault at the first line of code in main()
:
(gdb) run -f ../data.bin -o ../ -v e
Starting program: /cygdrive/c/Users/user/tool/tool.exe -f ../data.bin -o ../ -v e
[New Thread 17108.0x1854]
[New Thread 17108.0x4c84]
[New Thread 17108.0x4204]
[New Thread 17108.0x42c0]
Thread 1 "tool" received signal SIGSEGV, Segmentation fault.
0x00000003ef753916 in cygstdc++-6!_ZNSo6sentryC1ERSo () from /usr/bin/cygstdc++-6.dll
(gdb) backtrace
#0 0x00000003ef753916 in cygstdc++-6!_ZNSo6sentryC1ERSo () from /usr/bin/cygstdc++-6.dll
#1 0x00000003ef7d7049 in cygstdc++-6!_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l () from /usr/bin/cygstdc++-6.dll
#2 0x00000003ef7e6259 in cygstdc++-6!_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc () from /usr/bin/cygstdc++-6.dll
#3 0x000000010040135b in main (argc=7, argv=0xa00001d60) at /cygdrive/c/Users/user/tool/src/main.cpp:42
And main.cpp:42
is exactly this line:
int main( int argc, char* argv[] )
{
std::cout << "Argument Count";
...
}
Do you have any ideas why std::cout
is causing this?