c++ - 为什么没有击中断点?
问题描述
不久前我开始使用 Linux,我正在尝试运行一些为 Windows 制作的旧代码。他们正在运行,但我不能调试,断点没有被击中。我已经看到与此有关的许多问题都与未在“MakeFile”中添加“-g”有关,但似乎不是我的情况。我正在使用Vscode,在调试过程中我的断点是这样的
这是我的制作文件:
CC=gcc
CFLAGS= -o -W -ggdb -g
LDFLAGS= -lm -lstdc++
OBJFILES = main.o Funcoes.o Mat_Vet.o rotinas_matematicas.o Classes.o SME5720.o
TARGET = ss
all: $(TARGET)
$(TARGET): $(OBJFILES)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJFILES) $(LDFLAGS)
clean:
rm -f $(OBJFILES) $(TARGET) *~
这是我的json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/ss",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
解决方案
通过更改“MakeFile”解决了我的问题,我不知道它为什么会起作用。如果有人能说出原因。这是我的新生成文件:
output: main.o Classes.o Funcoes.o Mat_Vet.o rotinas_matematicas.o SME5720.o
g++ main.o Classes.o Funcoes.o Mat_Vet.o rotinas_matematicas.o SME5720.o -o output
main.o:main.cpp
g++ -c -g main.cpp
Classes.o: Classes.cpp Classes.h
g++ -c -g Classes.cpp
Funcoes.o: Funcoes.cpp Funcoes.h
g++ -c -g Funcoes.cpp
Mat_Vet.o: Mat_Vet.cpp Mat_Vet.h
g++ -c -g Mat_Vet.cpp
rotinas_matematicas.o: rotinas_matematicas.cpp rotinas_matematicas.h
g++ -c -g rotinas_matematicas.cpp
SME5720.o: SME5720.cpp SME5720.h
g++ -c -g SME5720.cpp
clean:
rm *.o output
推荐阅读
- javascript - 赛普拉斯:拦截一条不存在的路线
- c++ - 不存在从 std::shared_ptr 到 std::shared_ptr 的合适的用户定义转换
- python - 如何在 Django 中一个类的多个函数之间共享一个变量?
- powershell - powershell-get-random-and-rename 该目录下的所有内容,包括子目录下的所有文件
- python - ML BoW:对单词变量的预测包的每个集群进行采样,以查看哪些单词最重复地聚集在一起
- arrays - 在 C 中使用 calloc() 和 free()
- javascript - 为什么 CSS 在某些路由上不起作用?
- python - 使用 django 获取 html 模板中特定变量的值
- javascript - ReferenceError:导出函数时未定义req
- pandas - 熊猫抓取数据框:必须通过二维输入。形状=(1, 21, 2)