Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need help regarding ld: fatal error

Posted on 2002-03-18
1
Medium Priority
?
273 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 84

Accepted Solution

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures 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.

704 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