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?

1
  • 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 online for writing makefiles. Commented Oct 16, 2019 at 5:27

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

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/

3 Comments

so is there no way for me to use make in git bash then?
@fatlady98 Unfortunately, no. You can't use Git Bash for anything beyond basic tasks and Git.
This isn't true. All you need is the correct PATH environment variable pointing to the correct paths for your development tools.
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++, ...)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.