1

Backround

I have been coding (mostly C) on Linux so far but i want to be able to code on Windows as well. So i searched for a better editor than notepad and found Visual Studio Code that has extensions to make your life easier.


Problem

I wanted to use a makefile with the command make for more complex compilations of my .c files, but it doesn't seem to recognize the command make no matter what extensions i tried for Visual Studio Code nor from the embeded terminal.


Extensions Tried

ioannis-kokkalis
  • 432
  • 1
  • 3
  • 13
  • 1
    In Linux, make comes with the system. In Windows, it does not. Extensions to VSCode may provide you _interfaces_ to run the make program, but they will not contain the make program itself. You'll have to install that separately. – MadScientist Sep 27 '20 at 14:25
  • @MadScientist ohh okey, thanks! (i even ran into some sources that said to install make into the system but i wasn't sure if that was my case) – ioannis-kokkalis Sep 27 '20 at 16:03

4 Answers4

1

Firstly, I would ensure that make is installed on your system.

Secondly, if make is installed, make sure you are operating from the correct directory. If you open a terminal using Terminal > New Terminal and type in make, does it work. If so then you may just need to create a simple task that runs on an F5 press or whatever OR just type make in to build every time.

If make doesn't work, make sure you are using the directory containing the makefile as your WD or otherwise cd or set your settings in those extensions to use a subdir as the root.

Emily-TTG
  • 531
  • 3
  • 18
0

In Windows, the compiler that comes with Visual Studio is MSVC. You are most probably using cl.exe to compile your files. Visual Studio projects has .vcxproj extension.

GCC, on the other hand, is the most used compiler in Linux environments. Its project file is a Makefile, which is compiled by make command.

There are a couple of options in Windows.

  1. You can opt-in to use Windows default development environment Visual Studio. Its debugging capabilities are very good. You may not like this option if you are a terminal guy.
  2. You can use MinGW to port GCC to Windows. Makefile will work in this option. Keep in mind that this is not a native solution.
  3. You can use the cross platform solution CMake. After writing a CMakeLists.txt, it will create the project file depending on your compiler (Makefile for GCC, or .sln and .vcxproj files for MSVC). You can use both terminal to compile your files and open the solution file to debug your applications in Visual Studio.

VSCode is not an IDE, it is a fancy text editor with extensions. Once you have decided what development environment to use, you can find related extensions to make your life easier.

Burak
  • 2,251
  • 1
  • 16
  • 33
0

I ran into the same problem and discovered that I was using a wrong path in my environment.

The right reference for me was: Edit the PATH variable (in the environment Variables interface of the PC) to add that path of the folder containing the make.exe binary.

starball
  • 20,030
  • 7
  • 43
  • 238
Said
  • 1
0

I had the same problem and i fixed it by adding " C:\msys64\usr\bin " to " PATH ". " C:\msys64\usr\bin " contain the " make " file