🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by Dan Mon, 23 Jul 2007 10:51
Problem with the "Packet32.h" file.........
#1505
Author: Dan
Date: Mon, 23 Jul 2007 10:51
52 lines
3466 bytes

Hi all,

I'm not sure if this is the right group for this question.

I'm working with Builder 4.0, I had to take a project that was
compiled on Builder 6.0 and make it compile on Builder 4.0, 
after debuging work I got to conclusion that the problems start
with the include of the file "Packet32.h".

To test it, I opened a New Project on builder 4.0, and I just 
included the file "Packet32.h" right below the "Unit1.h" 
include line in the "Unit1.cpp" file, when I compile it I'm
getting lot of errors, here is the list - 

[C++ Error] winsock2.h(95): E2257 , expected.
[C++ Error] winsock2.h(111): E2303 Type name expected.
[C++ Error] winsock2.h(111): E2139 Declaration missing ;.
[C++ Warning] winsock2.h(114): W8054 Style of function definition is now obsolete.
[C++ Error] winsock2.h(114): E2257 , expected.
[C++ Error] winsock2.h(1206): E2303 Type name expected.
[C++ Error] winsock2.h(1250): E2303 Type name expected.
[C++ Error] winsock2.h(1250): E2139 Declaration missing ;.
[C++ Error] winsock2.h(1605): E2141 Declaration syntax error.
[C++ Error] winsock2.h(1628): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1649): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1666): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1687): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1708): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1729): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1750): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1843): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1896): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1919): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1971): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(1994): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(2021): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(2046): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(2063): E2141 Declaration syntax error.
[C++ Error] winsock2.h(2532): E2147 'SOCKET' cannot start a parameter declaration.
[C++ Error] winsock2.h(2555): E2141 Declaration syntax error.
[C++ Error] winsock2.h(2555): E2228 Too many error or warning messages.

....
For example I get the first Error ("winsock2.h(95): E2257 , expected") on the following line in the Winsock2.h line - 

typedef UINT_PTR        SOCKET;

What can be the problem here?

Thanks.
Re: Problem with the "Packet32.h" file.........
#1506
Author: Alan Bellingham
Date: Mon, 23 Jul 2007 11:40
18 lines
1560 bytes
"Dan" <Dan@Nomail.com> wrote:

>For example I get the first Error ("winsock2.h(95): E2257 , expected") on the following line in the Winsock2.h line - 
>
>typedef UINT_PTR        SOCKET;
>
>What can be the problem here?

Most likely, it hasn't got a clue what a UINT_PTR is - so it can't
define what a SOCKET is based on that.

After that, anything attempting to use the SOCKET type will obviously be
unable to compile either.

Alan Bellingham
-- 
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Re: Problem with the "Packet32.h" file.........
#1507
Author: Darko Miletic
Date: Mon, 23 Jul 2007 12:24
11 lines
1557 bytes
Dan wrote:
> Hi all,
> 
> I'm not sure if this is the right group for this question.
> 
> I'm working with Builder 4.0, I had to take a project that was
> compiled on Builder 6.0 and make it compile on Builder 4.0, 
> after debuging work I got to conclusion that the problems start
> with the include of the file "Packet32.h".

put #include <windows.h> before that header.
Re: Problem with the "Packet32.h" file.........
#1508
Author: Darko Miletic
Date: Mon, 23 Jul 2007 12:59
32 lines
2296 bytes
Darko Miletic wrote:
> Dan wrote:
>> Hi all,
>>
>> I'm not sure if this is the right group for this question.
>>
>> I'm working with Builder 4.0, I had to take a project that was
>> compiled on Builder 6.0 and make it compile on Builder 4.0, after 
>> debuging work I got to conclusion that the problems start
>> with the include of the file "Packet32.h".
> 
> put #include <windows.h> before that header.

Now I have to rectify my response. I just saw that you said builder 4.0.
The thing is that builder 4 has older platform sdk that does not contain 
the latest version of base windows headers (in this case windef.h and 
basetsd.h). These new headers define UINT_PTR HALF_PTR etc.

All that is explained on this page:

Windows Data Types
http://msdn2.microsoft.com/En-US/library/aa383751.aspx

Take a look and manually add all definitions before including Packet32.h.

Something like this:

#ifndef UINT_PTR
  typedef unsigned int UINT_PTR;
#endif /*UINT_PTR*/

#include "Packet32.h"
Re: Problem with the "Packet32.h" file.........
#1509
Author: Dan
Date: Mon, 23 Jul 2007 13:28
22 lines
1257 bytes

Thanks very much!  :-)

I got rid of all the Errors & Warnings after I added this - 


#ifndef ULONG_PTR  
  typedef unsigned int ULONG_PTR;
#endif /*ULONG_PTR*/

#ifndef DWORD_PTR
  typedef unsigned int DWORD_PTR;
#endif /*DWORD_PTR*/

#ifndef UINT_PTR
  typedef unsigned int UINT_PTR;
#endif /*UINT_PTR*/

#include "Packet32.h"

Well done!
Re: Problem with the "Packet32.h" file.........
#1516
Author: Darko Miletic
Date: Tue, 24 Jul 2007 20:41
27 lines
1776 bytes
Dan wrote:
> Thanks very much!  :-)
> 
> I got rid of all the Errors & Warnings after I added this - 
> 
> 
> #ifndef ULONG_PTR  
>   typedef unsigned int ULONG_PTR;
> #endif /*ULONG_PTR*/
> 

Actually this one should be (just for consistency)

#ifndef ULONG_PTR
   typedef unsigned long ULONG_PTR;
#endif /*ULONG_PTR*/

> #ifndef DWORD_PTR
>   typedef unsigned int DWORD_PTR;
> #endif /*DWORD_PTR*/
> 

And this one too:

#ifndef DWORD_PTR
   typedef unsigned long DWORD_PTR;
#endif /*DWORD_PTR*/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads