c - Command-line arguments via Makefile -


I am creating a messphilos for a program that runs a simple text-editing program and a file command line argument However, I am running this problem, however, when I try to pass in a command line parameter in the makefile, the compiler does not accept any file or gives some kind of error to indicate that linking is incorrect. My source code for Makefile looks like this:

  1All: basic.c2GCC-O Original 2 Basic 2C Data Type 3: Basic 2 4 GCC- O Basic 2 basic 2 5 origin 2. O: Original 2C6GCC Basic 2C data   

and the resulting output:

  Designing an input file   < p> is that the program should print, if basic2.c is run without any argument, such as data. Would I move the parameter to a different line, or is there a better way to write this code?  

In addition, for reference, basic2.c uses the following code:

  main (int argc, char * argv []) 7 {8 if ( argc & gt; 2) {9 printf ("many file names \ n"); 10 Exit (0); 11} 12 if (argc! = 2) {13 printf ("wants a file name \ n"); 14 exits (0); 15}   

Am I referring to the wrong indicator of argv?

It looks like you run in your third build block Trying to do basic 2 if you had to make the first goal then to compile and run it, then it probably means to do this: < pre> # All depends on the writing, which depends on the original 2, which depends on the basic2.c all: Write to write command: Basic 2 ./basic2 data # Basic 2 compiled To do Area Command: Basic 2.c gcc -o original 2 basic 2. O

Then, using command will create this basic2 , if it has changed, and then run the code.

Command write to do this create .

Command Creating original 2 will be compiled if needed only.

Of course, all: Write is not necessary in this case, but if you have other things that you want to create together, then type After this will be useful to add more reliance.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -