DISCLAIMER: I'm not an expert or professional and am simply teaching myself. So my attempts to solve this may have been rudimentary at best.
In C++, whenever I try to compile a program using the <cmath>
library, compiling will complete, but when the program attempts to execute I get a runtime error. A Windows dialogue box pops up saying the program has stopped working and is searching for a solution. Instead of just asking you folks, I figured I would try to learn a bit and give it my best shot first. So I loaded up GDB and tried running the program with that to shed a little more light on what is going on.
When running a program including the <cmath>
library, GDB immediately outputs the following (regardless of where I place the breakpoint):
warning: Could not load shared library symbols for C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AE_MailSensor_Plugin.dll.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\ame_outlooksensor.dll.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\ame_smtpsensor.dll.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\OS_Plugin.dll.
Do you need "set solib-search-path" or "set sysroot"?
warning: Could not load shared library symbols for C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\COM_sensor.dll.
Do you need "set solib-search-path" or "set sysroot"?
If I place the breakpoint on main
it stops here. If I allow it to run without a breakpoint or instruct GDB to move to the next step I receive:
Program received signal SIGSEGV, Segmentation fault.
0x6fc85cd1 in libstdc++-6!_ZNSo9_M_insertIdEERSot_ ()
from C:\Users\Me\Desktop\libstdc++-6.dll
From what I can gather, it looks like for some reason my system is having an issue loading the <cmath>
library, but I'm still not really sure why. The first three warnings look like files related to e-mail processes, but that makes very little sense to me (but again I don't know very much). So that's about where I'm stuck.
FYI: I am running Windows 7 enterprise, using MinGW and G++ for my compiler.
EDIT: I have tried compiling the program with debug symbols enabled by using -g. When doing this the backtrace is reduced to only #0, #1, and #2 (see comment below for original backtrace) with #2 appended by `at C:\Users\me\desktop\file.cpp: 19. Indicating line 19 which is the last step before the method. This case is repeated in more simple programs with the line indicated being the last step before a method is called.
Is it possible there is a version issue going on akin to this question which points to this forum thread? I'm using gcc version 4.8.1
EDIT: per request of @pm100. code:
#include <cmath>
#include <iostream>
using namespace std;
int main() {
cout << floor(2.3);
}
for compiling: (i am using notepad++)
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\mingw\bin\g++ "$(FULL_CURRENT_PATH)" -o "$(NAME_PART).exe" -g
cmd /c $(NAME_PART).exe