Pelles C forum

C language => Beginner questions => Topic started by: rob on April 08, 2007, 07:00:23 AM

Title: prototypes
Post by: rob on April 08, 2007, 07:00:23 AM
I'm having troubles with the missing prototype warning.  I have the function:
Code: [Select]
int GetNext()
{
int n = GetTickCount();
n=n%3;
n++;
return n; 
}
with the prototype:
Code: [Select]
int GetNext();
But it still gives me the warning. Is there something I'm missing?
Title: Re: prototypes
Post by: JohnF on April 08, 2007, 08:21:07 AM
You should have

int GetNext(void)
{
 code
}

John
Title: Re: prototypes
Post by: rob on April 09, 2007, 12:55:02 AM
that gave me an error.
error #2120: Redeclaration of 'GetNext' previously declared
found 'int __stdcall function(void)' expected 'int __cdecl function'.
*** Error code: 1 ***
Title: Re: prototypes
Post by: JohnF on April 09, 2007, 07:03:55 AM
Do you have the prototype anywhere else, for example in a header?

John
Title: Re: prototypes
Post by: sp00n on April 18, 2007, 10:33:23 AM
hi all
I have the problem with the same warning.
Project is developing for PockePC and when I want to include some usefull functions from MS Platform Builder (file "Pkfuncs.h") it's write me that warning (and others like  warning #2099: Missing type specifier) and a many errors.
How can I resolve it?

P.S. Does anybody know how reboot the PocketPC from application? (i try to do it by KernelIoControl function, but can't build the project 'cause has a subject warning)
Title: Re: prototypes
Post by: JohnF on April 18, 2007, 12:04:08 PM
Prototypes and functions should match

int SomeFunc(void);

int SomeFunc(void)
{
 code
}

I don't have Pkfuncs.h so can't comment.

John
Title: Re: prototypes
Post by: sp00n on April 18, 2007, 03:03:33 PM
Code: [Select]
typedef struct _CALLBACKINFO {
    HANDLE  hProc;      /* destination process */
    FARPROC pfn;        /* function to call in dest. process */
    PVOID   pvArg0;     /* arg0 data */
} CALLBACKINFO;
typedef CALLBACKINFO *PCALLBACKINFO;
there is a warning about missing prototype.

May be the "C" syntax doesn't support it construction? Or something else?

And another:
warning #2099: Missing type specifier.
Code: [Select]
BOOL CeSetExtendedPdata(LPVOID pData);BOOL and LPVOID defined in windef.h

And there are many analog warnings.

P.S. This is Pkfuncs.h file)
Title: Re: prototypes
Post by: JohnF on April 18, 2007, 04:13:35 PM
Code: [Select]
typedef struct _CALLBACKINFO {
    HANDLE  hProc;      /* destination process */
    FARPROC pfn;        /* function to call in dest. process */
    PVOID   pvArg0;     /* arg0 data */
} CALLBACKINFO;
typedef CALLBACKINFO *PCALLBACKINFO;
there is a warning about missing prototype.

May be the "C" syntax doesn't support it construction? Or something else?

It just compiled here with no problems.

Quote
And another:
warning #2099: Missing type specifier.
Code: [Select]
BOOL CeSetExtendedPdata(LPVOID pData);BOOL and LPVOID defined in windef.h

What are your includes ? E.G. #include <windows.h>

John

Title: Re: prototypes
Post by: sp00n on April 18, 2007, 05:18:20 PM
I've added in the pkfucs.h including windows.h but it doesn't make any effect :(

in my main project are following includes:
Code: [Select]
#include <windows.h>
#include <windowsx.h>
#include <aygshell.h>
#include "main.h"  //my header for the project
#include <windef.h>  //i've included after that when saw the troubles(
#include <Pkfuncs.h>
command line for compiler:
 -Tarm-coff -W2 -Gz -Ze -D_WINCE -DUNICODE

all include folders i've added normally to the project properties with full existing paths:)
Title: Re: prototypes
Post by: JohnF on April 18, 2007, 05:25:39 PM
windef.h is already included by including windows.h

I suggest you post an attachment of a small project that shows the problem, someone that uses WINCE will be able to help.

John
Title: Re: prototypes
Post by: sp00n on April 18, 2007, 06:03:17 PM
hm, just in my project I wanna use a KernelIoControl function, that defined in Pkfuncs.h
In MS VC++ 8.0 all works well, but in Pelles C I have this problem:(
As a project is a small tool, so I wanna use Pelles C - exe-file has a 15Kb size:), in MS VC - 600Kb
Ok, in anyway thanks for your answers, John.