Reputation: 11
I started to use Linux a while ago, and I'm trying to run some old codes that were made for windows. They are running, but I can't Debug then, the breaking points aren't being hit. I've seen that many problems with this are related to not adding the "-g" at the "MakeFile", but not seems to be my case. I'm using Vscode, my breaking points get like this during the debugging
Here is my Make file:
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) *~
Here's my 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
}
]
}
]
}
Upvotes: 0
Views: 82
Reputation: 11
Solved my problem by changing the "MakeFile", I don't know why it works. If anyone could say why. Here is my new 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
Upvotes: 1