简体   繁体   中英

Trying to compile simple c++ program in make

I am having trouble with make. I installed all of the features that come with cygwin. When I type in make command it says:

make:***No targets specified and no makefile found. Stop.

This is really annoying as it's a very simple program. My make file (Makefile):

# This is a sample file.

all: lab1

lab1: lab1.o
 g++ -Wall lab1.o -o lab1

lab1.o: lab1.cpp
 g++ -Wall -c lab1.cpp -o lab1.o

my program (lab1.cpp):

// This is a sample file written.

#include <iostream>

using namespace std;

int main() {
  cout << "Welcome to CS-240!" << endl;
  return 0;
  }

The issue (fixed in the comments) was that there was a Makefile.mak in the directory but not an actual Makefile without an extension. Changing the name worked for the submitter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM