How to compile a file in unix or linux

apple_77

Distinguished
Jan 18, 2011
9
0
18,510
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.
 

apple_77

Distinguished
Jan 18, 2011
9
0
18,510

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'
 

apple_77

Distinguished
Jan 18, 2011
9
0
18,510

Thank u Pyroflea.I will do some reading about GCC online.This is first time i heard about GCC.I had learned something new.
 

someone19

Distinguished
Jan 16, 2011
441
3
18,810


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.
 

madman559

Distinguished
Jan 13, 2011
15
0
18,510


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