开发者

how to create a "makefile" for c++?

开发者 https://www.devze.com 2023-04-03 18:30 出处:网络
I usually work on visual c++ 2010 for creating console ap开发者_Python百科plications as programming problems. There is this submission which requires me to give the source for the file \"Makefile\" by

I usually work on visual c++ 2010 for creating console ap开发者_Python百科plications as programming problems. There is this submission which requires me to give the source for the file "Makefile" by some command in unix environment

all: g++ program.cc -o program

since i don't use unix and have never created a "makefile". I don't know how to make this submission. I have read about a makefile which is supposed to give the directions dependencies etc for compiling the program. I am using the header files iostream string and iterator in the program. i have tried the "all:" command . The bash returns command not found.

Can someone help me with this submission? The code is ready but the only thing stopping for submitting is this "makefile". please include the shell commands as well.


You're missing newline and two tabs (yes, you read right, not spaces) after the all: line, something like this:

all:
        g++ helloworld.cc -o helloworld

To invoke make, type make in the directory with the Makefile. Dependencies on system headers are usually not considered, if your code has just one file, you can safely ignore that.

0

精彩评论

暂无评论...
验证码 换一张
取 消