NO

Author Topic: prototypes  (Read 5455 times)

rob

  • Guest
prototypes
« 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?

JohnF

  • Guest
Re: prototypes
« Reply #1 on: April 08, 2007, 08:21:07 am »
You should have

int GetNext(void)
{
 code
}

John

rob

  • Guest
Re: prototypes
« Reply #2 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 ***

JohnF

  • Guest
Re: prototypes
« Reply #3 on: April 09, 2007, 07:03:55 am »
Do you have the prototype anywhere else, for example in a header?

John

sp00n

  • Guest
Re: prototypes
« Reply #4 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)

JohnF

  • Guest
Re: prototypes
« Reply #5 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

sp00n

  • Guest
Re: prototypes
« Reply #6 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)
« Last Edit: April 18, 2007, 04:00:09 pm by sp00n »

JohnF

  • Guest
Re: prototypes
« Reply #7 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


sp00n

  • Guest
Re: prototypes
« Reply #8 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:)

JohnF

  • Guest
Re: prototypes
« Reply #9 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

sp00n

  • Guest
Re: prototypes
« Reply #10 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.