Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
int main(int argc, char **argv)
{
char *dev; /* name of the device to use */
char *net; /* dot notation of the network address */
char *mask;/* dot notation of the network mask */
int ret; /* return code */
char errbuf[PCAP_ERRBUF_SIZE];
bpf_u_int32 netp; /* ip */
bpf_u_int32 maskp;/* subnet mask */
struct in_addr addr;
/* ask pcap to find a valid device for use to sniff on */
dev = pcap_lookupdev(errbuf);
I try to compile the file (ldev.c) in fedora 7 using the command
>> gcc ldev.c -lpcap but the following errors have occcured :-
ldev.c:3:46: error: pcap.h: No such file or directory
ldev.c: In function ‘main’:
ldev.c:15: error: ‘PCAP_ERRBUF_SIZE’ undeclared (first use in this function)
ldev.c:15: error: (Each undeclared identifier is reported only once
ldev.c:15: error: for each function it appears in.)
ldev.c:16: error: ‘bpf_u_int32’ undeclared (first use in this function)
ldev.c:16: error: expected ‘;’ before ‘netp’
ldev.c:17: error: expected ‘;’ before ‘maskp’
ldev.c:21: warning: assignment makes pointer from integer without a cast
ldev.c:34: error: ‘netp’ undeclared (first use in this function)
ldev.c:34: error: ‘maskp’ undeclared (first use in this function)
yes I know that the printf in the c code will send the output to the
terminal .
but I doesn't want to run the outputfile as "./a.out" instead
I want that when I use the command "gcc ldev.c -lpcap" the output in the terminal after that should be
but I doesn't want to run the outputfile as "./a.out"
As Nylex already pointed out, you cannot compile and run a program at the same time. You can eventually give a different name to the executable and put it in some directory specified in your PATH, e.g. $HOME/bin. In this way you can type the name of the executable without the leading ./. For example:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.