473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

An error which is driving me slowly mad

Here's a problem which is driving me slowly insane. Using GCC version
3.3.1 on SuSE 9.0, I keep getting "undefined reference to
`function'"-type errors for no apparent reason! It's driving me
bonkers. Here's a tiny sample program which reproduces the problem.
I've also included an extract of the shell session I used to launch it
(so you can tell me if I'm missing any crucial commandline
parameters), and an excerpt from the -aux-info dump which seems to say
that the function in question WAS in fact defined.

It's enough to make me gibber!
/**SOF:"test.c"**/
#include <stdio.h>
#include <math.h>

int main(int argc, char* argv[]) {
double x;
for(x=0; x<=32; x++) {
printf("%2.0f : %6.3f\n",x,sin(x*3.141592653/16));
}
}
/**EOF**/
/**SOT:"shell extract"**/
greyknight@gaius:> gcc -aux-info test.dump -o test test.c

/tmp/ccO1su8V.o(.text+0x55): In function `main':
: undefined reference to `sin'
collect2: ld returned 1 exit status
bash: ./test: No such file or directory
/**EOT**/
/**SOT:"test.dump extract"**/
/* /usr/include/bits/mathcalls.h:66:NC */ extern double sin (double);
/**EOT**/
Nov 14 '05 #1
2 1550
Grey Knight <gr*********@yahoo.com> scribbled the following:
Here's a problem which is driving me slowly insane. Using GCC version
3.3.1 on SuSE 9.0, I keep getting "undefined reference to
`function'"-type errors for no apparent reason! It's driving me
bonkers. Here's a tiny sample program which reproduces the problem.
I've also included an extract of the shell session I used to launch it
(so you can tell me if I'm missing any crucial commandline
parameters), and an excerpt from the -aux-info dump which seems to say
that the function in question WAS in fact defined.


You'll want to add -lm to your GCC invocation command line.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"I am lying."
- Anon
Nov 14 '05 #2
In article <73**************************@posting.google.com >,
Grey Knight <gr*********@yahoo.com> wrote:
/tmp/ccO1su8V.o(.text+0x55): In function `main':
: undefined reference to `sin'


That's an FAQ. Really. See Question #14.3 in:

http://www.eskimo.com/~scs/C-faq/top.html

--
rr
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Filth | last post by:
Hi I have the partial section of a script below as you will see its not exactly great but im learning slowly but surely. When I have error_reporting(E_ALL); set I get the following error...
3
by: Darren | last post by:
Hi Oracle experts, We are getting this error on our Oracle system. I've searched Google, MSDN, Oracle tech support and newsgroups to death, but our DBAs seem to have already applied all the...
6
by: Keiron Waites | last post by:
Please see the problem in action here: http://www.leadbullet.biz/contact.php If you mouse over the fields, you will see that text is shown on the right. The text makes the other fields move when...
7
by: Jim | last post by:
I really hope someone can help me with the below problem. It's driving me insane. I have a form with two combo boxes (say, combo1 and combo2) and a list box (listbox1). When the user selects a...
10
by: David | last post by:
Hello I am trying to collect errors and record them in a table instead of a popup message stopping my code. It seems to work ok, but when I try to add ERR.Description to my code it fails on Syntax...
26
by: Bruno Jouhier [MVP] | last post by:
I'm currently experiencing a strange phenomenon: At my Office, Visual Studio takes a very long time to compile our solution (more than 1 minute for the first project). At home, Visual Studio...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
5
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly...
1
by: rose.kevin | last post by:
Hi I am trying to make a little tool tip box pop up when you hover the mouse over one of our custom filetypes in Windows explorer. And it is slowly driving me insane. I have a created a dll,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.