Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Prototype warnings with Borland win32 project

Ed HallEd Hall Posts: 395Member
I have the following declarations near the beginning of my code:
[code]
void swapWin(HWND window);
void UpdateWin();
void NextCommand();
void CheckButtons();
void InitPosBox();
void cancelCommand();
void handleTimer1();
[/code]

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

[code]Call to function "all of the above" with no protoype in function...[/code]

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

Comments

  • tsagldtsagld Posts: 621Member
    : I have the following declarations near the beginning of my code:
    : [code]
    : void swapWin(HWND window);
    : void UpdateWin();
    : void NextCommand();
    : void CheckButtons();
    : void InitPosBox();
    : void cancelCommand();
    : void handleTimer1();
    : [/code]
    :
    : However, when I compile my source I get loads of the following warning against all the calls to the above functions:
    :
    : [code]Call to function "all of the above" with no protoype in function...[/code]
    :
    : 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


  • Ed HallEd Hall Posts: 395Member
    : 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
    :
    [blue]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:
    [code]
    #include
    #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"
    ... [blue]// these initialize large arrays[/blue]
    #include "phlength.h"

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

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

    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)
    {
    ... [blue]// calls from here to all above functions give warnings[/blue]
    [blue]// except for the call to AboutDlgProc[/blue]
    }

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    LPSTR lpCmdLine, int nCmdShow)
    {
    ...
    }
    [/code]

    Thanks for helping me through these learning experiences...

    Take Care,
    Ed
    [/blue]

  • tsagldtsagld Posts: 621Member
    : : 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
    : :
    : [blue]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:
    : [code]
    : #include
    : #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"
    : ... [blue]// these initialize large arrays[/blue]
    : #include "phlength.h"
    :
    : void CheckButtons();
    : void NextCommand();
    : void UpdateWin();
    : void swapWin(HWND window);
    : void InitPosBox();
    : void cancelCommand();
    : void handleTimer1();
    :
    : void handleTimer1() [blue]// each of the following call back and forth[/blue]
    : { [blue]// with warnings proclaimed[/blue]
    : ...
    : }
    :
    : 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)
    : {
    : ... [blue]// calls from here to all above functions give warnings[/blue]
    : [blue]// except for the call to AboutDlgProc[/blue]
    : }
    :
    : int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    : LPSTR lpCmdLine, int nCmdShow)
    : {
    : ...
    : }
    : [/code]
    :
    : Thanks for helping me through these learning experiences...
    :
    : Take Care,
    : Ed
    : [/blue]
    :
    :
    Aha. Got it. Look at the spelling of your checkButtons function and prototype....


    Greets,
    Eric Goldstein
    www.gvh-maatwerk.nl


  • Ed HallEd Hall Posts: 395Member
    : Aha. Got it. Look at the spelling of your checkButtons function and prototype....
    :
    :
    : Greets,
    : Eric Goldstein
    : www.gvh-maatwerk.nl
    :
    [blue]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[/blue]
  • Ed HallEd Hall Posts: 395Member
    I had to add "void" to all my prototypes...

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

    This did:
    [code]
    void UpdateWin(void);
    void NextCommand(void);
    void CheckButtons(void);
    void InitPosBox(void);
    void cancelCommand(void);
    void handleTimer1(void);
    [/code]

    I erroneously added the prototype

    [code]
    void swapWin(HWND window);
    [/code]

    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


Sign In or Register to comment.