473,796 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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@gaiu s:> gcc -aux-info test.dump -o test test.c

/tmp/ccO1su8V.o(.tex t+0x55): In function `main':
: undefined reference to `sin'
collect2: ld returned 1 exit status
bash: ./test: No such file or directory
/**EOT**/
/**SOT:"test.dum p extract"**/
/* /usr/include/bits/mathcalls.h:66: NC */ extern double sin (double);
/**EOT**/
Nov 14 '05 #1
2 1572
Grey Knight <gr*********@ya hoo.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.hel sinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"I am lying."
- Anon
Nov 14 '05 #2
In article <73************ **************@ posting.google. com>,
Grey Knight <gr*********@ya hoo.com> wrote:
/tmp/ccO1su8V.o(.tex t+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
1509
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 (script works fine without this):- Notice: Undefined variable: error in
3
14145
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 solutions suggested. Here's the relevant part from the Listener log: TNS-12500: TNS:listener failed to start a dedicated server process TNS-12540: TNS:internal limit restriction exceeded TNS-12560: TNS:protocol adapter error
6
1613
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 it is shown - even though the width of the text is less than the width of the field. WHY? This is driving me nuts - please help! TIA,
7
2061
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 value in combo1, the AfterUpdate event kicks in, does some stuff, and moves focus to combo2. The code looks something like this: Private Sub combo1_AfterUpdate 'do stuff
10
605
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 Error (missing operator). Any help would be very much appreciated Thanks Dave Dim strSql As String strSql = "INSERT INTO tbllogoftimedevents(Log)VALUES('" &
26
10885
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 compiles the same solution much faster (about 10 seconds for the first project). My home computer is only marginally faster than the one I have at the office (P4 2.53 vs. P4 2.4, same amount of RAM). On the slow machine, the CPU usage is very low,...
10
2727
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 VS, however, when I change to release and put it out on the web it fails giving me the following error message The underlying connection was closed. Could not establish a trust relationship with the remote server.
5
6543
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 new to VB.NET, so I need some help. Here is a code snippit :
1
2037
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, with this as the code: using System; using System.IO;
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.