LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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

Reply
 
Search this Thread
Old 12-02-2004, 12:52 AM   #1
chiahsin
LQ Newbie
 
Registered: Dec 2004
Posts: 6

Rep: Reputation: 0
Lightbulb gcc compiling problem


hello

here is my code
#include <sys/ipc.h>
#include <sys/msg.h>
#include <unistd.h>
#include <stdio.h>

int man(int argc, char **argv)
{
int c,oflag,mqid;

oflag=0600 | IPC_CREAT;
while ((c = getopt(argc,argv,"e")) != -1)
{
switch (c)
{
case 'e':
oflag |= IPC_EXCL;
break;
}
}

if (optind != argc - 1)
printf("usage: test [-e] <pathname>\n");
mqid=msgget(ftok(argv[optind],0),oflag);
return 0;
}

and when I compile , ld return error

gcc -o test test.c

/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
 
Old 12-02-2004, 03:00 AM   #2
exitium
LQ Newbie
 
Registered: Nov 2004
Posts: 12

Rep: Reputation: 0
umm... I'm a newbie when it comes to C/C++ code but you don't have main function at all. There's a typo so you have int man -function. But you propably allready noticed that...

BR:
Exitium
 
Old 12-02-2004, 06:33 PM   #3
chiahsin
LQ Newbie
 
Registered: Dec 2004
Posts: 6

Original Poster
Rep: Reputation: 0
hello:


I keep looking up the code in the main block but ignore the main itself.
Thank you!!

Regards,
steven
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with gcc compiling courier-authlib? Please help! strimp099 Linux - Software 3 07-20-2005 07:03 PM
Problem compiling code in g++ works for gcc juan_de_margo Programming 3 02-24-2005 03:41 AM
GCC compiling problem C, SuSE 9.1 Bill Chandler Linux - Software 3 11-24-2004 01:30 AM
GCC compiling problem webwolf70 Linux From Scratch 3 09-25-2004 08:51 PM
Problem compiling gcc gkiagia Programming 4 05-31-2004 03:18 AM


All times are GMT -5. The time now is 02:56 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration