473,396 Members | 2,111 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,396 software developers and data experts.

Undefined reference to "sq"

365 100+
I am doing small c prog using math, I wanted to square a value, when I do "sq((float)val1)", I am getting undefined reference. also I am using 'sqrt', I am able to pass compile for that by passing "-lm" and include "math.h", how to fix 'sq' issue?. thanks.
Oct 14 '09 #1
3 4279
mac11
256 100+
The undefined reference error probably means the linker doesn't have the function to link. I think more details are needed about your project.

I'm not aware of any standard 'sq()' function, where is it defined? Is it some code you wrote, in a library you have somewhere, something else?
Oct 14 '09 #2
tvnaidu
365 100+
Thanks first. I got sample prog from net to calculate RMS value, but I got sqrt and sq as undefined errors, I fixed sqrt by including math.h and pass '-lm', but sq still undefiend.
Oct 14 '09 #3
Banfa
9,065 Expert Mod 8TB
sq is not a standard function. Nor is there a standard function to squaring a value that I am aware of since it is a relatively simple operation; for any basic integer or floating point type T

T square;
T value = <someValue>;

square = value * value;

The maths library only contains implementations for non-trivial functions, for example square root, cos, log.
Oct 14 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

99
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a...
13
by: Squid Seven | last post by:
This is just bizarre. for the following snippet of code: #include <string> using std::string; I get the error message:
10
by: aagee | last post by:
Hi all Can someone clue me in on this? I just noticed that following doesn't work as it used to: window.open(... "fullscreen=yes" ...) Used to get a window that occupied the whole screen;...
388
by: maniac | last post by:
Hey guys, I'm new here, just a simple question. I'm learning to Program in C, and I was recommended a book called, "Mastering C Pointers", just asking if any of you have read it, and if it's...
7
by: James Johnson | last post by:
Are there structs in JavaScript? If not, what's the closest thing, or do I just use parallel arrays? I'm populating a JavaScript array from ColdFusion query, but I don't think I can do this: ...
1
by: Java Guy | last post by:
I'm trying to view a web page. IE tells me there are (Java?) errors on the page. Here they are: Line: 15 Char: 7 Error: Wrong number of arguments or invalid propert assignment Code: 0 URL:...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.