I am running GCC version 6.2 and GDB version 7.12. I am running on Windows 10 using Mingw from MSYS2 with Codeblocks. When I try to run the following test sample, GDB says that the weird_variable
is not available in this scope.
#include <iostream>
#include <vector>
#include <utility>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <string>
#include <unordered_set>
using namespace std;
struct PathPair{
int start = -1;
int end = -1;
int time = -1;
};
std::unordered_map<std::string, PathPair> weird_variable;
int main()
{
PathPair p;
p.start = 55;
p.end = 100;
p.time = 550;
weird_variable["I"] = p;
std::cout << weird_variable["I"].end;
return 0;
}
I do have the -g
option, I've also tried a bunch of others like -g3
. The exact command that Codeblocks ran was:
g++.exe -Wall -fexceptions -g -Wall -std=c++11 -m64 -g -IE:\msys2\mingw64\bin -IE:\msys2\mingw64\lib -c E:\codeblocksworkspace\TEST\main.cpp -o obj\Debug\main.o
g++.exe -o bin\Debug\TEST.exe obj\Debug\main.o -m64
Output file is bin\Debug\TEST.exe with size 706.11 KB
However, as I step through the code in the debugger line by line weird_variable
is still "unavailable". Is there any way I can see it short of printing it every time I want to look at it? Can anyone reproduce this?
Aucun commentaire:
Enregistrer un commentaire