C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Prototype warnings with Borland win32 project Posted by Ed Hall on 21 Apr 2006 at 7:28 PM
I have the following declarations near the beginning of my code:
void swapWin(HWND window);
void UpdateWin();
void NextCommand();
void CheckButtons();
void InitPosBox();
void cancelCommand();
void handleTimer1();


However, when I compile my source I get loads of the following warning against all the calls to the above functions:

Call to function "all of the above" with no protoype in function...


Isn't my above list the prototypes for all the functions? Or am I just placing them in the wrong location in my source code? Or maybe I'm totally off track?

The program runs fine, but I don't like to see so many warnings, and wonder if there may be an issue at some point.

Thanks for all help.

Take Care,
Ed

Report
Re: Prototype warnings with Borland win32 project Posted by tsagld on 21 Apr 2006 at 10:49 PM
: I have the following declarations near the beginning of my code:
:
: void swapWin(HWND window);
: void UpdateWin();
: void NextCommand();
: void CheckButtons();
: void InitPosBox();
: void cancelCommand();
: void handleTimer1();
: 

:
: However, when I compile my source I get loads of the following warning against all the calls to the above functions:
:
:
Call to function "all of the above" with no protoype in function...

:
: Isn't my above list the prototypes for all the functions? Or am I just placing them in the wrong location in my source code? Or maybe I'm totally off track?
:
: The program runs fine, but I don't like to see so many warnings, and wonder if there may be an issue at some point.
:
: Thanks for all help.
:
: Take Care,
: Ed
:
:
It could be that the compiler encouters the calls to the functions before it encounters the prototypes. That's why it is more elegant to have the prototypes in separate header files and #include them in all sources that contains calls to the functions.
If that is not the case, pls post some more code.


Greets,
Eric Goldstein
www.gvh-maatwerk.nl


Report
Re: Prototype warnings with Borland win32 project Posted by Ed Hall on 22 Apr 2006 at 6:42 AM
: It could be that the compiler encouters the calls to the functions before it encounters the prototypes. That's why it is more elegant to have the prototypes in separate header files and #include them in all sources that contains calls to the functions.
: If that is not the case, pls post some more code.
:
:
: Greets,
: Eric Goldstein
: www.gvh-maatwerk.nl
:
I could only have both the prototypes and functions a very little bit closer to the front than they are now. In fact, I usually build my functions right after the protoypes right after all the variables are defined, as you'll see below. I'm probably supposed to have them somewhere else for win32, or perhaps I need to build a class or something?

There is only one source file (.c) with several #includes (.h). None of the includes has any function calls. They are large array initializers and combobox fillers. Almost all of the program runs 100% on two different machines.

Here's a stripped down version of the source:
#include <windows.h>
#include "BECommnd.h" // resource file

const char g_szClassName[] = "myWindowClass";
HWND		hwnd, ...;

char		ExtKey, FKey = 'F', EKey = 'E';
UINT		Timer1, Timer2;
int		TType = 5, Timer, position = 0,
		MIN_POSITION = 0, MAX_POSITION = 0;
DWORD		PBIndex;
char		Position[100][65];
char		PositionTemp[65];
char		Command[500];

#include "CmdBox.h"
 ...                   // these initialize large arrays
#include "phlength.h"

void CheckButtons();
void NextCommand();
void UpdateWin();
void swapWin(HWND window);
void InitPosBox();
void cancelCommand();
void handleTimer1();

void handleTimer1()  // each of the following call back and forth
{                    // with warnings proclaimed
 ...
}

void cancelCommand()
{
 ...
}

void InitPosBox()
{
 ...
}

void swapWin(HWND window)
{
 ...
}

void UpdateWin()
{
 ...
}

void NextCommand()
{
 ...
}

void checkButtons()
{
 ...
}

BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
 ...
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
 ...   // calls from here to all above functions give warnings
       // except for the call to AboutDlgProc
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	 LPSTR lpCmdLine, int nCmdShow)
{
 ...
}


Thanks for helping me through these learning experiences...

Take Care,
Ed


Report
Re: Prototype warnings with Borland win32 project Posted by tsagld on 22 Apr 2006 at 2:29 PM
: : It could be that the compiler encouters the calls to the functions before it encounters the prototypes. That's why it is more elegant to have the prototypes in separate header files and #include them in all sources that contains calls to the functions.
: : If that is not the case, pls post some more code.
: :
: :
: : Greets,
: : Eric Goldstein
: : www.gvh-maatwerk.nl
: :
: I could only have both the prototypes and functions a very little bit closer to the front than they are now. In fact, I usually build my functions right after the protoypes right after all the variables are defined, as you'll see below. I'm probably supposed to have them somewhere else for win32, or perhaps I need to build a class or something?
:
: There is only one source file (.c) with several #includes (.h). None of the includes has any function calls. They are large array initializers and combobox fillers. Almost all of the program runs 100% on two different machines.
:
: Here's a stripped down version of the source:
:
: #include <windows.h>
: #include "BECommnd.h" // resource file
: 
: const char g_szClassName[] = "myWindowClass";
: HWND		hwnd, ...;
: 
: char		ExtKey, FKey = 'F', EKey = 'E';
: UINT		Timer1, Timer2;
: int		TType = 5, Timer, position = 0,
: 		MIN_POSITION = 0, MAX_POSITION = 0;
: DWORD		PBIndex;
: char		Position[100][65];
: char		PositionTemp[65];
: char		Command[500];
: 
: #include "CmdBox.h"
:  ...                   // these initialize large arrays
: #include "phlength.h"
: 
: void CheckButtons();
: void NextCommand();
: void UpdateWin();
: void swapWin(HWND window);
: void InitPosBox();
: void cancelCommand();
: void handleTimer1();
: 
: void handleTimer1()  // each of the following call back and forth
: {                    // with warnings proclaimed
:  ...
: }
: 
: void cancelCommand()
: {
:  ...
: }
: 
: void InitPosBox()
: {
:  ...
: }
: 
: void swapWin(HWND window)
: {
:  ...
: }
: 
: void UpdateWin()
: {
:  ...
: }
: 
: void NextCommand()
: {
:  ...
: }
: 
: void checkButtons()
: {
:  ...
: }
: 
: BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
: {
:  ...
: }
: 
: LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
: {
:  ...   // calls from here to all above functions give warnings
:        // except for the call to AboutDlgProc
: }
: 
: int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
: 	 LPSTR lpCmdLine, int nCmdShow)
: {
:  ...
: }
: 

:
: Thanks for helping me through these learning experiences...
:
: Take Care,
: Ed
:

:
:
Aha. Got it. Look at the spelling of your checkButtons function and prototype....


Greets,
Eric Goldstein
www.gvh-maatwerk.nl


Report
Re: Prototype warnings with Borland win32 project Posted by Ed Hall on 22 Apr 2006 at 5:45 PM
: Aha. Got it. Look at the spelling of your checkButtons function and prototype....
:
:
: Greets,
: Eric Goldstein
: www.gvh-maatwerk.nl
:
Thanks, but not the solution. I missed that one because of all the other warnings. (It still doesn't like that one either.) Every one of my protoypes appears to be being ignored. Well, at least the program runs fine... I must have to containerize them or something...

Thanks for the try.

Take Care,
Ed

Report
Re: Prototype warnings - Solved! Posted by Ed Hall on 23 Apr 2006 at 5:15 PM
I had to add "void" to all my prototypes...

This didn't work:
void UpdateWin();
void NextCommand();
void CheckButtons();
void InitPosBox();
void cancelCommand();
void handleTimer1();


This did:
void UpdateWin(void);
void NextCommand(void);
void CheckButtons(void);
void InitPosBox(void);
void cancelCommand(void);
void handleTimer1(void);


I erroneously added the prototype

void swapWin(HWND window);


to my earlier messages. Its absence from the warnings led me to finding the need for void.

Thanks, Eric, for your help.

Take Care,
Ed





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.