0

Hi I'm trying to create a Makefile for the first time but I have some problems...I run this in the terminal to compile my project "g++ -I/mingw64/include/ncurses -o filename filename.cpp -lncurses -L/mingw64/bin -static", What the make file should be?

the error:make : Term 'make' not recognized as name of cmdlet, function, executable program or script file. Check the spelling of the name or verify that the path is included and correct, then try again. Line:1 machine:1

  • do
  •   + CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
      + FullyQualifiedErrorId: CommandNotFoundException
    
    
    

I don't know what i wrote there, I just followed a tutorial :/

  • *"main project doesn't recognize the Make command"* What does this mean? Please show your makefile, the error, and so on. – HolyBlackCat Mar 01 '23 at 19:28
  • Manually setting `-L` is suspicious. The compiler should search this directory automatically. – HolyBlackCat Mar 01 '23 at 19:28
  • # Specify compiler to be used CXX = g++ CXXFLAGS += -g -std=c++17 -fPIC -march=x86-64 # Specify paths to headers INCLUDES += -I -lncurses -static -/mingw64/include/ncurses # Specify paths to the libraries LDFLAGS += -L/mingw64/bin # Specify the link libraries LLIBS += -lfftw3 # ... add other configs ... $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(OBJ_DIR) $(CXX) -c $(CXXFLAGS) $(INCLUDES) $< -o $@ $(OBJ_DIR)/$(PROGRAM): $(OBJS) $(CXX) $(LDFLAGS) $^ $(LLIBS) -o $@ – gianluca sperti Mar 01 '23 at 19:33
  • I don't know what I wrote, I followed a tutorial :/ – gianluca sperti Mar 01 '23 at 19:35
  • Please [edit] your question and add this code, there you can format it properly. It's unreadable in a comment. Also add the error message. – HolyBlackCat Mar 01 '23 at 19:36
  • 1. [Images of code are discouraged](https://meta.stackoverflow.com/q/285551/2752075), you should post that as text. 2. Do you have MSYS2 installed? If no, [install it](https://stackoverflow.com/q/30069830/2752075). Then install Make using `pacman -S make`. Then try running it from MSYS2 shell. You can then figure out how to switch VSC to MSYS2 shell, in place of Powershell it uses now. – HolyBlackCat Mar 01 '23 at 19:50
  • I installed it, but it doesn't appear in the list of shells – gianluca sperti Mar 01 '23 at 20:12
  • For now you can use it outside of VSC (there should be a shortcut in the start menu). There should be tutorials for installing it as a VSC shell. – HolyBlackCat Mar 01 '23 at 20:13
  • Sorry but I'm new in this world, I think that the problem is in the make file, if I have to run this command to compile "g++ -I/mingw64/include/ncurses -o filename filename.cpp -lncurses -L/mingw64/bin -static" what should I write in the Make File? – gianluca sperti Mar 01 '23 at 20:20
  • Your problem is not with the makefile. There's this program called `make` which executes commands spelled in makefiles. Your error says this program wasn't found, so whatever is in the makefile is irrevelant. I see some typos in there, so once you do manage to run `make` you'll have to deal with those, but that's the next step. – HolyBlackCat Mar 01 '23 at 20:23
  • Ok I installed the make command with choco – gianluca sperti Mar 01 '23 at 21:26
  • I DID IT, thanks for all!!! – gianluca sperti Mar 01 '23 at 21:36
  • If it works for you, good, but I'd stick to the version of Make MSYS2 ships, since you're already using it. – HolyBlackCat Mar 01 '23 at 22:03
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 02 '23 at 05:35

0 Answers0