Reputation: 2962
I am working on an assignment for class, and we are to work off of a class server where the code files are held.
I have copied the files to my home directory, and have been editing with vim (since my instructor for some reason prefers it to emacs).
But how do I actually test my code? the make file is provided, and when I type make test.c
, I get back make: Nothing to be done for test.c
. I don't understand why this is happening, because I have a print statement as the first line in main
. Shouldn't that at least run? Also, how do I pass arguments to the main
function test.c
while using make
??
As a side question, this server doesn't have gdb
either, for some reason. I'm sure there is an alternative installed, I just don't know what it would be called to try and see if it's here.
Upvotes: 0
Views: 25189
Reputation: 1
Simply save your code and then open the command prompt and write these command
Upvotes: 0
Reputation: 5241
I think you need some basic knowledge in make
. You should read some basic books on makefile
and actually try it out. If you just try to stick concepts to your mind, but never actually try it out, you will never get it.
Check out this question. It asks for good tutorials on GNU Make
. Also, so that you can go directly to the links, this and this are links mentioned in the main answers.
Upvotes: 0
Reputation: 263237
The argument to make
is usually the thing you want it to create. Since test.c
already exists, make test.c
doesn't do anything. make test
should compile test.c
to create test
. make
with no arguments uses a default target specified in the Makefile
; in your case it's probably the same as make test
.
The make
command doesn't run your program; it creates an executable that you can then run.
Once you've typed make
or make test
, you should be able to execute your program by typing
./test
The ./
is important; without it, you'll probably invoke the shell's built-in test
command, which is not what you want.
Upvotes: 2
Reputation: 1504
Maybe what u need is only this build command:
gcc test.c -o test
Then:
./test
Have a try. ^_^
Upvotes: 1