1

Straight up new to the whole thing, i need to start using make and I dont know where to type my

make program: main.o funcs.o
    g++ main.o funcs.o -o program

make main.o: main.cpp funcs.h
    g++ -c main.cpp

make funcs.o: funcs.cpp funcs.h
    g++ -c funcs.cpp

How do i create the "makefile" file in my directory, does it have a file extension? Once i create it do i just start typing these in the terminal or do i edit my makefile, is it like a makefile.txt and i edit that to add rules?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
fatlady98
  • 11
  • 2
  • I am assuming that you are using windows. You can treat `Makefile` as any other file in the directory. Use your favorite editor to create a file named `Makefile` (no extension like `.txt`). You can edit the file using any editor of your choice; even notepad for that matter. You would find many tutorials and [beginner's guides](https://www.google.com/search?q=writing+your+first+makefile) online for writing makefiles. – anishsane Oct 16 '19 at 05:27

3 Answers3

1

This is totally doable in Git Bash as it is a mingw environment which can run any executable compiled for that - not just git itself.

Here are other tools that can be run - including make: How to add more to Git Bash on Windows

credits to: https://stackoverflow.com/a/66525071/12438919

andekande
  • 91
  • 3
0

Git Bash contains necessary tools (like core utilities, wget, cURL etc.) for you to use it as a version control environment. It is a stripped down version of MSYS2 and there's no way to extend it.

If you want to do full-fledged development in such an environment, you should look into using MSYS2 as your environment, where you can add packages using pacman command (the same as in Arch Linux / Manjaro). There are build tools like make and GCC, as well as Python and Perl. It's a complete version of development environment (including Git).

https://www.msys2.org/

iBug
  • 35,554
  • 7
  • 89
  • 134
0

Instead of git bash, you might consider, if you are with Windows 10, using WSL (Windows Subsystem for Linux).

See for instance Using C++ and WSL in VS Code, where, after a sudo apt-get install build-essential gdb, you would get everything you need (make, g++, ...)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250