LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 06-07-2005, 01:22 PM   #1
shengchieh
Member
 
Registered: Jul 2004
Location: Palo Alto, CA
Distribution: #! Korora
Posts: 472

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
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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: 31
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



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
which programming language is used to do tcp/ip programming?? gajaykrishnan Linux - Networking 9 12-21-2012 05:16 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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:43 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration