473,396 Members | 2,089 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.

completely stuck

I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get some
feedback.

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

int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", Pow (x, y));
return 0;
}

The code looks fine to me. But there could be something quite apparent
that I'm missing. This while linking to the math library too.

Bill
Jun 27 '08 #1
17 1330
On May 29, 3:54 am, "Bill Cunningham" <nos...@nspam.comwrote:
I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get some
feedback.

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

int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", Pow (x, y));
return 0;

}

The code looks fine to me. But there could be something quite apparent
that I'm missing. This while linking to the math library too.
It should tell you that 'Pow' is undefined, not 'pow'. C's identifiers
are case sensitive.
Jun 27 '08 #2
"Bill Cunningham" <no****@nspam.comwrites:
I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get some
feedback.

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

int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", Pow (x, y));
return 0;
}

The code looks fine to me. But there could be something quite apparent
that I'm missing. This while linking to the math library too.
It's not telling you that "pow" is undefined.
It's telling you that "Pow" is undefined.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #3

<vi******@gmail.comwrote in message news:59d60972-bef7-4b5b-b9ea-It
should tell you that 'Pow' is undefined, not 'pow'. C's identifiers
are case sensitive.
It is. Oh silly me. Thanks. I hate uppercase. It must've been a typo.

Bill
Jun 27 '08 #4

"Keith Thompson" <ks***@mib.orgwrote in message
news:ln************@nuthaus.mib.org...
It's not telling you that "pow" is undefined.
It's telling you that "Pow" is undefined.
It is. Oh silly me. Thanks. I hate uppercase. It must've been a typo.
Bill
Jun 27 '08 #5
Bill Cunningham wrote:
I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get some
feedback.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
Should be <Math.h>.
int
main (int argc, char *argv[])
Should be Int Main.
{
if (argc != 3)
{
puts ("usage error");
ITYM Puts.
exit (EXIT_FAILURE);
ITYM Exit(exit_Failure);
}
double x, y;
Should be DOUBLE.
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
Should be StrtOD ... null in both instances.
printf ("%.2f\n", Pow (x, y));
Should be Printf ... poW(...)
return 0;
Should be Return Zero;
}

The code looks fine to me. But there could be something quite apparent
that I'm missing. This while linking to the math library too.

Bill
Glad to be of help, bILL. Good-bye.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Jun 27 '08 #6
On Thu, 29 May 2008 00:54:16 GMT, "Bill Cunningham" <no****@nspam.com>
wrote:
I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get some
feedback.
Since your code never references the pow function, it is unlikely that
that is what the error message says. Look at it again. Look at it
carefully. Remember, C is case sensitive. If you still have a
question, cut and paste the complete text of the error message in your
message to this newsgroup.
>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", Pow (x, y));
return 0;
}

The code looks fine to me. But there could be something quite apparent
that I'm missing. This while linking to the math library too.


Remove del for email
Jun 27 '08 #7
On Thu, 29 May 2008 02:26:47 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
Bill Cunningham wrote:
>#include <math.h>

Should be <Math.h>.

...

Glad to be of help, bILL. Good-bye.
Wouldn't it be more helpful, and save you a lot of typing, if you simply
told the poster that he had used 'Pow' instead of 'pow' and that C is case
sensitive? Just like vippstar and Keith Thompson did.

--
Martin

Jun 27 '08 #8
Martin <m@b.cwrites:
On Thu, 29 May 2008 02:26:47 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
>Bill Cunningham wrote:
>>#include <math.h>

Should be <Math.h>.

...

Glad to be of help, bILL. Good-bye.

Wouldn't it be more helpful, and save you a lot of typing, if you
simply told the poster that he had used 'Pow' instead of 'pow' and
that C is case sensitive? Just like vippstar and Keith Thompson did.
Eric has correctly surmised that Bill is a troll.
Jun 27 '08 #9
Richard wrote:
Martin <m@b.cwrites:
>On Thu, 29 May 2008 02:26:47 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
>>Bill Cunningham wrote:
#include <math.h>

Should be <Math.h>.

...

Glad to be of help, bILL. Good-bye.

Wouldn't it be more helpful, and save you a lot of typing, if you
simply told the poster that he had used 'Pow' instead of 'pow' and
that C is case sensitive? Just like vippstar and Keith Thompson did.

Eric has correctly surmised that Bill is a troll.
But then forgotten not to feed trolls...

Bye, Jojo
Jun 27 '08 #10

"Bill Cunningham" <no****@nspam.comwrote in message
news:Y8n%j.3991$fk.2302@trnddc06...
I have this code and it will not compile telling me that pow is
undefined. I'm not quite sure what to make of this so I thought I'd get
some feedback.

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

int
main (int argc, char *argv[])
{
if (argc != 3)
{
puts ("usage error");
exit (EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", Pow (x, y));
return 0;
}
All you have to do is combine the good bits of the above code, and the code
you posted 3 days ago:

"Bill Cunningham" <no****@nspam.comwrote in message
news:z3J_j.3440$tF1.560@trnddc01...
Is this one of those rare instances where casts are needed? I have this
code and the compiler complains that the prototypes are wrong.

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

int
main (int argc, char *argv[])
{
if (argc != 4)
{
puts ("usage error");
exit(EXIT_FAILURE);
}
double x, y;
x = strtod (argv[1], NULL);
y = strtod (argv[2], NULL);
printf ("%.2f\n", pow (argv[1], argv[2]));
return 0;
}
--
Bartc
Jun 27 '08 #11
Martin wrote:
On Thu, 29 May 2008 02:26:47 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
>Bill Cunningham wrote:
>>#include <math.h>

Should be <Math.h>.

...

Glad to be of help, bILL. Good-bye.

Wouldn't it be more helpful, and save you a lot of typing, if you simply
told the poster that he had used 'Pow' instead of 'pow' and that C is
case sensitive? Just like vippstar and Keith Thompson did.
After reading (and sometimes answering) Mister Bill's
questions for what seems a long time, I have come around
to the opinion that he is not seeking help, but merely
response. That is, I think he's trolling.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Jun 27 '08 #12
Eric Sosman <es*****@ieee-dot-org.invalidwrites:
Martin wrote:
>On Thu, 29 May 2008 02:26:47 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
>>Bill Cunningham wrote:
#include <math.h>

Should be <Math.h>.

...

Glad to be of help, bILL. Good-bye.

Wouldn't it be more helpful, and save you a lot of typing, if you
simply told the poster that he had used 'Pow' instead of 'pow' and
that C is case sensitive? Just like vippstar and Keith Thompson did.

After reading (and sometimes answering) Mister Bill's
questions for what seems a long time, I have come around
to the opinion that he is not seeking help, but merely
response. That is, I think he's trolling.
The problem is that most of the regs are so obnoxious and rude to new
posters that they see Bill as a kind of penance and rush to help the
poor guy with the "learning difficulties". I don't buy it for one minute
that he can't understand case or that #ifdef's have matching #endifs or
that brackets determine scope etc. He is most definitely a troll.

Jun 27 '08 #13
Hello list, Bill

I usually try a minimal sample to reproduce the error first, like:

#include <math.h>

int main ()
{
int x, y;
Pow(x, y);
return 0;
}
If I can't figure what is going on after that, read the headers
source, try to access other functions (some header can be out of the
include's path, who knows?). A little search of source code samples
over the web (or any sources in your machine who access the same
headers and still works) helps too (at east, the search can refresh
your mind and then you can figure the typo. Can happen with anyone).
If, after that, I still have a question, then, maybe, I can ask around
on lists or something. Of course, this typo have no reason to be in
this list (but I think that is completely OT, believe you or not). You
should update your debug/problem solving skills some way (an you are
the only one who can figure how to develop that).

Regards
Rafael
Jun 27 '08 #14

"soscpd" <so****@gmail.comwrote in message news:c8cca2dd-aa3f-40c5-989e-
If I can't figure what is going on after that, read the headers
source, try to access other functions (some header can be out of the
include's path, who knows?). A little search of source code samples
over the web (or any sources in your machine who access the same
headers and still works) helps too (at east, the search can refresh
your mind and then you can figure the typo. Can happen with anyone).
If, after that, I still have a question, then, maybe, I can ask around
on lists or something. Of course, this typo have no reason to be in
this list (but I think that is completely OT, believe you or not). You
should update your debug/problem solving skills some way (an you are
the only one who can figure how to develop that).

Regards
Rafael
I completely overlooked the error and (believe it or not ) I thought the
compiler overlooked case problems anyway so I've learned something today.
Sometimes I jump the gun and go to clc for help and end up embarrassing
myself like in this situation. I thought I had a real problem and now I just
end up with a red face :(

Bill
Jun 27 '08 #15
On Thu, 29 May 2008 13:08:19 +0100, Eric Sosman
<es*****@ieee-dot-org.invalidwrote:
After reading (and sometimes answering) Mister Bill's
questions for what seems a long time, I have come around
to the opinion that he is not seeking help, but merely
response. That is, I think he's trolling.
Ah OK. Thanks Eric, I asked and you've answered.

I wonder if Bill simply posts into clc too quickly, as he's explained
later. Only he knows. Perhaps he'll learn from the experience.

--
Martin

Jun 27 '08 #16
On May 30, 12:11 pm, Martin <m...@b.cwrote:
On Thu, 29 May 2008 13:08:19 +0100, Eric Sosman

<esos...@ieee-dot-org.invalidwrote:
After reading (and sometimes answering) Mister Bill's
questions for what seems a long time, I have come around
to the opinion that he is not seeking help, but merely
response. That is, I think he's trolling.

Ah OK. Thanks Eric, I asked and you've answered.

I wonder if Bill simply posts into clc too quickly, as he's explained
later. Only he knows. Perhaps he'll learn from the experience.
He's posting newbie and ambiguous questions for 4 years now, or
perhaps more time.
It's a troll. Just a troll.
Jun 27 '08 #17
vi******@gmail.com wrote:
Martin <m...@b.cwrote:
>Eric Sosman <esos...@ieee-dot-org.invalidwrote:
>> After reading (and sometimes answering) Mister Bill's
questions for what seems a long time, I have come around
to the opinion that he is not seeking help, but merely
response. That is, I think he's trolling.

Ah OK. Thanks Eric, I asked and you've answered. I wonder if
Bill simply posts into clc too quickly, as he's explained later.
Only he knows. Perhaps he'll learn from the experience.

He's posting newbie and ambiguous questions for 4 years now, or
perhaps more time. It's a troll. Just a troll.
No, he has actually learned something. Not much, but something.
He's not a troll.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #18

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

Similar topics

1
by: No | last post by:
I purchased a program ( So I thought) that turned out to be just a bunch of php scripts put together. I am getting terrible support from the author but I am biting my tongue because I don't want...
8
by: MLH | last post by:
I use a mouse-down procedure to trap right mouse clicks and CTRL-Right mouse clicks. Running the procedure must put honey or some other sticky substance into my keyboard because subsequent...
4
by: Astronomically Confused | last post by:
using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; class HttpProcessor { private Socket s;
2
by: Eugene | last post by:
Hi all, Probably an easy question, but I'm kinda stuck. Here's the scenario - I have a datagrid with, let's say, 10 rows. Now, if I click on a cell in 10th row, and then update underlying...
4
by: Aaron Smith | last post by:
I post a message about this, but noone responded.. Well, I've played around as much as I can and I'm completely stuck and out of ideas. This should be a really simple task, but it seems that it...
4
by: =?Utf-8?B?TWF1cg==?= | last post by:
My cd is stuck in the drive. I can open the drawer O K but the c d will not come out Help me please -- Maur
0
by: =?Utf-8?B?QmlsbEI=?= | last post by:
This is a tough one... My Windows Service app periodically performs some processing on new entries to a SQL Server database table. It uses a simple System.Timer to call the Elapsed event...
18
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for reasons I do not know, a Connect call will totally lock up the thread and never return. I am sure it has something to do...
7
by: alphasahoo | last post by:
Hi I am working on a program which writes the output a SQL select statements from number of source tables first to a load matrix and then writes to a load.dat file. But while writing to the...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
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...

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.