2
I’m using cmd to program, and I want to make a batch file that automates the build process. I want him to Compile the files using the command
g++ -c ./scr/Nome.cpp -o ./obj/Nome.o -std=c++1z
This should be done for all files .cpp
which have been edited since the last compilation (I thought of doing an input, like this Nome
would be the text the user typed, the program would then only continue if the user entered an empty line), and finally and run
cd obj
g++ Arq1.o Arq2.o -o ../a.exe
Putting all files in the obj folder instead of Arq1.o Arq2.o
How can I do that?
I recommend using the Cmake+Nmake. Making your own batch file to check the changes since the last build is nothing simple and it’s something that the build systems do natively. After all, that’s what they’re for: build software.
– Fernando Silveira
@Fernandosilveira I understand. I don’t usually compile by CLI, because I always used Ides
– Felipe Nascimento
@Fernandosilveira Just one question, how can I debug my program line by line, because my program is going into infinite loop, but I can’t find where
– Felipe Nascimento
In the
gdb
use the commandbreak main
and thenrun
. When he stops at the breakpoint (functionmain
) you can use the commandsn
,s
,fin
andc
(next
,step
,finish
andcontinue
).– Fernando Silveira