Thread: What does this mean?

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    49

    What does this mean?

    Qns:
    A program called solvemaze should be produced when make task1 is executed in your submission directory, hence you need to create a Makefile. It will be passed the plain text file that represents a maze as the first command line argument and the maximum number of robot moves allowed as the second

    solvemaze is a executable.

    Does the above qns means, i need to produce a makefile that when run, it will produce a executable call solvemaze.
    So what does it means by " It will be passed the plain text file that represents a maze as the first command line argument and the maximum number of robot moves allowed as the second"


    Thanks in advance
    diana --> programming is tough

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    http://cboard.cprogramming.com/showt...light=makefile
    One of many examples of makefiles
    Try using the board "search" facility.

    It means your tutor wants to be able to type in
    Code:
    make
    ./solvemaze maze.txt 100
    The first command runs the make program, which reads a file called "Makefile" to build your program.
    The second command runs the executable file produced by make, with a maze file and a number of moves
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    It means that the program will be called like like this: ">solvemaze maze.txt 20", where maze.txt is the first command line argument and 20 is the second argument.

    gg

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    so this is the way that i should run my make and executable??

    Code:
    make
    
    ./solvemaze maze.txt 100
    Last edited by dianazheng; 10-20-2004 at 07:21 AM.
    diana --> programming is tough

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > so this is the way that i should run my make and executable??
    Looks just like what I said

    So first create a file called "Makefile" (see examples) and see what happens
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    i have my makefile, but i think this is not what the qns was asking, but i don't know, where i was wrong, maybe i just not sure how to write a makefile, cos there are many different version of makefile, i getting confuse with all that.

    Pls help me!!!

    Code:
    CC         = gcc
    CFLAG  = -Wall -g
    
    all : solvemaze
    
    solvemaze : readmaze.c robot2.c navigation.h robot.h
    
    clean :
    	rm -f readmaze.c robot2.c navigation.h robot.h
    Them when i run makefile, it gives me
    Code:
    ./makefile: line 1: CC: command not found
    ./makefile: line 2: CFLAGS: command not found
    ./makefile: line 5: all: command not found
    ./makefile: line 8: solvemaze: command not found
    ./makefile: line 12: clean: command not found
    Last edited by dianazheng; 10-20-2004 at 07:31 PM.
    diana --> programming is tough

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    clean :
    rm -f readmaze.c robot2.c navigation.h robot.h
    170H 220V 130M:> make clean

    You begin to make clean.

    That really did HURT!
    You wish your wounds would stop BLEEDING so much!

    -1H 220V 130M:>
    You are incapacitated an will slowly die, if not aided.

    -5H 220V 130M:>


    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    i don't get what you mean??
    diana --> programming is tough

  9. #9
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    He means you are going to cut your own hand off if you run make clean

  10. #10
    Registered User
    Join Date
    Oct 2004
    Posts
    49
    oooops, hahaha, i see.


    I think i get my makefile working, just that i am not sure where it is right or worng, can anyone check for me.
    thanks.

    This is my makefile:
    Code:
    solvemaze : readmaze.o robot2.o
    	cc readmaze.o robot2.o -o solvemaze
    
    readmaze.o : readmaze.c navigation.h robot.h
    	cc -c readmaze.c
    
    robot2.o : robot2.c navigation.h robot.h
    	cc -c robot2.c
    When i run it:
    Code:
    [diana@localhost ass2]$ make
    cc readmaze.o robot2.o -o solvemaze
    [diana@localhost ass2]$ ./solvemaze maze_a.txt 2
    ### - that was line 0
    #
     - that was line 1
    #.. - that was line 2
    $ done reading map
    $ -----------------------
    $  (Wallbot 0.1) at (2,1)
    $ (Wallbot 0.1) moved E
    $ -----------------------
    $  (Wallbot 0.1) at (3,1)
    $ (Wallbot 0.1) moved N
    $ (Wallbot 0.1) didn't win!
    i hope this was right.
    diana --> programming is tough

Popular pages Recent additions subscribe to a feed