1

I have my C++ code but I want to make my project work with make.

Till now, I was compiling it using g++. Like this

g++ -o main main.cc

But I will add more and more files and I want to use some sort of build system. I read that make can be used for that. So, I have my code

#include <iostream>

int main(int argc, char **argv) {
  if( argc >= 2 ) {
    std::cout << argv[0] << std::endl;
    std::cout << argv[1] << std::endl;
  } else if( argc == 1) {
    std::cout << argv[0] << std::endl;
  } else {
    std::cout << "Error" << std::endl;
  }
}

and I have my makefile

all:
  g++ -o main main.cc

But when I try to use make, I am getting error:

Makefile:2: *** missing separator.  Stop.

Where should I look for the source of the error? What is *** operator?

kelahcim
  • 51
  • 7

0 Answers0