473,396 Members | 1,809 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.

Missing Prototype

kreagan
153 100+
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
Aug 19 '07 #1
6 6354
weaknessforcats
9,208 Expert Mod 8TB
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.
Aug 19 '07 #2
kreagan
153 100+
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);
....
Aug 19 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
This compiles as C using Visual Studio.NET 2005.

I only had to change measueResistance() to explicity create the status variable.

Expand|Select|Wrap|Line Numbers
  1. int measureResistance(){
  2. int status = 0;    <<<<------- explicit int
  3.  
  4. //status = APP_DMM_Measure("resistance", &resistance ); 
  5.  
  6. //if (status !=0){ EL_logErrorData(status, "Error Measuring Resistance"); } 
  7.  
  8. return status; 
  9. }
  10. //////////////////
  11. int main()
  12. {
  13.     // Measure Resistance. Result should be 1700 ohms +/- 10%
  14. int status;
  15. status = measureResistance();
  16. //if ( status == 0 ){ status = testResistance( test_resistance, percent_error); }
  17. //.... 
  18.  
  19. }
  20.  
Aug 19 '07 #4
kreagan
153 100+
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().
Aug 19 '07 #5
kreagan
153 100+
Yay! I found the problem.

TestUtilities.h
Expand|Select|Wrap|Line Numbers
  1. ....
  2. int measureResistance();
  3. int testResistance( int test_resistance, double percent_error);
  4. ....
instead of int measureResistance();
it should have been

Expand|Select|Wrap|Line Numbers
  1. int measureResistance(void);
Aug 19 '07 #6
weaknessforcats
9,208 Expert Mod 8TB
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.
Aug 19 '07 #7

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

Similar topics

8
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...
8
by: Robert | last post by:
Hi, I can use "with" like this: function MyObject(message) { this.message = message; } function _MyObject_speak() {
2
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'...
4
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...
2
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...
7
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>
5
by: Daz | last post by:
Hi everyone. My query is very straight forward (I think). What's the difference between someFunc.blah = function(){ ; } and
3
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...
9
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); }
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: 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
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
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
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...
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.