-1

Week 1 : After copying a file, can a duplicate file be compiled and run?

1
  • Of course the duplicate file can be compiled and run (iff there are no errors in the code). I presume you are talking about C code. Java won't allow that, because the public class name in the file should match with the filename in Java. Aug 9, 2017 at 9:58

2 Answers 2

0

How do you call make? It should be like make hello, not like make hello.c. make then will search for ways to make a file hello, finds hello.c as a likely source, and will invoke clang.

0

The question needs more context. Are you copying the file to another directory, or to the same directory and giving it a new name? What's the command that you're using to compile the new file? Are you trying to build in the same directory as the source file? What is the full sequence of commands that you're using to get to the message "nothing to do"?

Yes, a file can be copied and compiled, but with restrictions. For example, a file can be copied to another directory and compiled in that directory. A file could be copied to a new filename in the same directory and compiled there, as in cp hello.c hello2.c followed by make hello2. But hello2 would not be compiled by make hello or make hello2.c The first case would compile using the hello.c file, while the second wouldn't compile anything.

If this doesn't answer your question, please edit your question and expand on what you're asking.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .