LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 06-07-2005, 01:22 PM   #1
shengchieh
Member
 
Registered: Jul 2004
Location: Palo Alto, CA
Distribution: #! lite 9.04
Posts: 465

Rep: Reputation: 30
Question what does these errors mean? (c programming)


To All:

I'm converting some of my fortran codes to c, so still a
beginner at c. I'm stumped. What does this error message
means?

/usr/lib/gcc-lib/i486-linux/3.3.2/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
/tmp/ccjwozJK.o(.text+0x25d): In function `Main':
: undefined reference to `fprint'
/tmp/ccjwozJK.o(.text+0x2a8): In function `Main':
: undefined reference to `fprint'
collect2: ld returned 1 exit status

My print statment (repeated twice) is

fprint("%i %f %f %f \n",
ipay,balbeg,xint[ipay],bal[ipay]);

where earlier I defined

float balbeg,bal[200],xint[200],xpay[200];
int npay,ipay;

The error "reference to main" seems to be unrelated to fprint.
[So I probably have two different errors]

Thanks in advance for any help.

Sheng-Chieh
 
Old 06-07-2005, 01:26 PM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Do you have a 'main' function?

Code:
#include <stdio.h>

int main(int argc, char **argv)
{
    /* your code goes here... */
    float balbeg,bal[200],xint[200],xpay[200];
    int npay,ipay;

    /* etc...  */
    return 0;
}
Thats usually the reason behind an "undefined reference to `main`" error.
 
Old 06-07-2005, 10:51 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.2, Centos 5.8
Posts: 11,740

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
BTW, just in case you hadn't been told, C is case sensitive.
Also, fprint will require you to include stdio lib
ie
#include <stdio.h>
at the top of your src file.
 
Old 06-07-2005, 10:58 PM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: At home: Arch, OpenBSD, Solaris. At work: CentOS, Debian, Ubuntu
Posts: 3,625

Rep: Reputation: 101Reputation: 101
Also, it's fprintf, not fprint.
 
Old 06-08-2005, 02:09 AM   #5
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 30
I think that in this case he means neither fprint nor fprintf, but printf. fprint does not exist and fprintf requires a file handler that isn't being provided in the code.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
which programming language is used to do tcp/ip programming?? gajaykrishnan Linux - Networking 8 01-15-2009 11:12 AM
[SOLVED] X programming lord_didger Linux - Newbie 4 08-22-2005 05:16 AM
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 02:42 AM
Errors during filesystem check with one kernel while no errors with other kernel Potentials Linux - General 11 12-30-2003 04:24 AM
QMAIL errors errors.. YourForum Linux - Software 0 11-27-2003 12:30 PM


All times are GMT -5. The time now is 06:06 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
Open Source Consulting | Domain Registration