I am out of ideas for this problem.
I have a .c file name AAT which includes TestUtilities.h. Within TestUtilities, I have a method named measureResistance() that AAT calls throught the code. TestUtilities also has other functions which AAT calls too. However, I get the error "Missing Prototype" for only measureResistance() calls.
Yes, I checked the the spelling in the AAT.c, TestUtilities.h, and TestUtilities.c files. The spelling and parameters are correct throught the three files.
Yes, I did include the .h file in the project.
Again, there are no other functions which generate this error within TestUtilities.
~Kat
6 6354
Locate the function definition for measureResistance and copy the first line to the prototype in TestUtilities.h. Add a semi-colon and rebuild. Often this error occurs not becuse the function name was incorrect but that the arguments or return type didn't match.
If that doesn't do it, post that section of TestUtilities.h and AAT.c where a call is made and I'll look at it.
Thanks for the help and quick response.
FYI, This is C, not C++. If I had different number of arguements, the compiler would state: "Insufficient number of arguement ...." or if the arguements were of the wrong type, the error would say, "Expecting TYPE A found TYPE B". From my understanding, method overloading doesn't exist in C. AAT.C
#include "TestUtilities.h"
...
// Measure Resistance. Result should be 1700 ohms +/- 10%
status = measureResistance();
if ( status == 0 ){ status = testResistance( test_resistance, percent_error); }
.... TestUtilities.C
int measureResistance(){
status = 0;
status = APP_DMM_Measure("resistance", &resistance );
if (status !=0){ EL_logErrorData(status, "Error Measuring Resistance"); }
return status;
} TestUtilities.h
....
int measureResistance();
int testResistance( int test_resistance, double percent_error);
....
This compiles as C using Visual Studio.NET 2005.
I only had to change measueResistance() to explicity create the status variable. -
int measureResistance(){
-
int status = 0; <<<<------- explicit int
-
-
//status = APP_DMM_Measure("resistance", &resistance );
-
-
//if (status !=0){ EL_logErrorData(status, "Error Measuring Resistance"); }
-
-
return status;
-
}
-
//////////////////
-
int main()
-
{
-
// Measure Resistance. Result should be 1700 ohms +/- 10%
-
int status;
-
status = measureResistance();
-
//if ( status == 0 ){ status = testResistance( test_resistance, percent_error); }
-
//....
-
-
}
-
This compiles as C using Visual Studio.NET 2005.
I only had to change measueResistance() to explicity create the status variable.
status is a global variable declaired elsewhere in the file.
Are you saying there is something wrong with my IDE/compiler? I'm using Lab Windows.
Furthermore, I can't place the function within the AAT.c for maintance reason. (The file is 3000+ lines of code and needs to be made into seperate files (classes?) soon).
I been coding in Java for the past 4 years and relatively new to C. Could there be a problem with how I'm accessing the TestUtilities class/functions? And what bothers me more is that I can access every other function in TestUtilities except measureResistance().
Yay! I found the problem. TestUtilities.h - ....
-
int measureResistance();
-
int testResistance( int test_resistance, double percent_error);
-
....
instead of int measureResistance();
it should have been - int measureResistance(void);
Ah, I missed that. I do C++ so much that empty parentheses mean no arguments but in C mean a function.
C has that feature where the arguments can be specified on the first call. That's a big problem area sonce there's no guarantee of consistency from one .c file to the next.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Elf M. Sternberg |
last post by:
One of the complaints about prototype.js (google for it if you're not
familiar with it) is that it's poorly documented. I have this inkling
that the key to understanding prototype.js is in the...
|
by: Robert |
last post by:
Hi,
I can use "with" like this:
function MyObject(message)
{
this.message = message;
}
function _MyObject_speak()
{
|
by: stephane |
last post by:
Hi all,
What I am trying to achieve is an 'inherits' method similar to Douglas
Crockford's (http://www.crockford.com/javascript/inheritance.html) but
that can enable access to the superclass'...
|
by: lkrubner |
last post by:
I'm reading an essay, I think one of Crockford's, and it has this
example in it:
function Demo() { }
Demo.prototype = new Ancestor();
Demo.prototype.foo = function () { } ;
Does Ancestor now...
|
by: Frank |
last post by:
The DB in question contains daily stock transactions keyed by ticker
(symbol) and date.
Unfortunately all dates do not exist for all ticker symbols.
To assist the process, there are two...
|
by: sergio.borghese |
last post by:
Hello,
Why this code compile without any warning?
I compile it on gcc 3.3.4 with the following command:
gcc -Wall -pedantic -ansi test.c
#include <stdlib.h>
#include <stdio.h>
|
by: Daz |
last post by:
Hi everyone.
My query is very straight forward (I think).
What's the difference between
someFunc.blah = function(){ ; }
and
|
by: Rakesh UV |
last post by:
Hi,
If i am not putting the function prototype of a function
returning a pointer, i get a core dump.Though this will happen less
probably on 32 bit machine
example
int main(int argc , char...
|
by: Boltar |
last post by:
On 32 bit linux with gcc 4.2 I get unexpected results with this code:
main()
{
int bits = 32;
printf("%d\n",(int)1 << (int)32);
printf("%d\n",(int)1 << bits);
}
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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: 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...
|
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,...
| |