Solved

Need help regarding ld: fatal error

Posted on 2002-03-18
1
266 Views
Last Modified: 2010-04-15
Here is my test program:

#include <stdio.h>
#include <math.h>

main () {
  double result;
  double x=2.718;

  result=log(x);
  printf("Log of %g is %.2g\n", x, result);
  return(0);
}

when I compile the program as follows:
cc test.c

I get the following error:

Undefined                       first referenced
 symbol                             in file
log                                 test.o
ld: fatal: Symbol referencing errors. No output written to a.out

The math.h file is in /usr/include. I tried compiling with -L /usr/include but it didn't work.


Thanks.
Theta.

0
Comment
Question by:theta
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 50 total points
ID: 6877360
cc test.c -lm
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now