Sign in with
Sign up | Sign in
Your question

How to compile a file in unix or linux

Last response: in Linux/Free BSD
Share
January 18, 2011 6:32:42 AM

i had to compile a file which is secure_pkt_send_rcv.c in unix or linux.How i compile the file?what are commands that can compile the file?thank u.
a b 5 Linux
January 18, 2011 8:15:23 AM

You'll want to use GCC most likely. There's plenty of documentation on how to use this compiler online, and you can check the man pages as well.

man gcc

Good luck,


- Jesse
m
0
l
January 19, 2011 2:48:07 AM

Just cd to the directory where the file is
and type

gcc secure_pkt_send_rcv.c

the compiled file will be a.out

so type ./a.out to run the file
m
0
l
Related resources
January 19, 2011 11:13:45 PM

madman559 said:
Just cd to the directory where the file is
and type

gcc secure_pkt_send_rcv.c

the compiled file will be a.out

so type ./a.out to run the file

Thank u madman559! But after i cd the file and i type in gcc secure_pkt_send_rcv.c
there is error occur.This is the error message:secure_pkt_send_rcv.c:6:error:expected'=', ',', ';','asm' or'_attribute_'before 'receive_secure_packet'
m
0
l
January 19, 2011 11:27:55 PM

Pyroflea said:
You'll want to use GCC most likely. There's plenty of documentation on how to use this compiler online, and you can check the man pages as well.

man gcc

Good luck,


- Jesse

Thank u Pyroflea.I will do some reading about GCC online.This is first time i heard about GCC.I had learned something new.
m
0
l
January 20, 2011 12:33:05 AM

apple_77 said:
Thank u madman559! But after i cd the file and i type in gcc secure_pkt_send_rcv.c
there is error occur.This is the error message:secure_pkt_send_rcv.c:6:error:expected'=', ',', ';','asm' or'_attribute_'before 'receive_secure_packet'


Its a rather specific file name, and I suspect it is one file that makes up a larger library or program. The commands are correct to compile that one file, but that's not the whole story typically. If that file is part of a software package, there are going to be make scripts and other setup steps that need to be made before the whole thing will work. Simply telling GCC to compile the file without the libraries, headers and definition files setup in the command line would be pointless, hence the errors and warnings you received. Basically GCC doesn't have enough information to compile that code.

In the root directory of the tar.??? you uncompressed should be a file README, or INSTALL etc... that has instructions on how to build and install the package. depending on the build system used, you'll typically have to run some combination of:

./configure && make && make install

If the author(s) of the program have things setup correctly, that will prepare the code to be compiled, compile the program and install it to the desired directories to be accessable to the system. If you get any errors at that stage, you may not have all the required dependencies or there is a bug in the package that needs to be addressed.

Good luck.
m
0
l
January 20, 2011 12:34:33 AM

apple_77 said:
Thank u madman559! But after i cd the file and i type in gcc secure_pkt_send_rcv.c
there is error occur.This is the error message:secure_pkt_send_rcv.c:6:error:expected'=', ',', ';','asm' or'_attribute_'before 'receive_secure_packet'


If it is a standalone file you may try posting the code in the programming section of the forums.
m
0
l
!