NO

Author Topic: Using Pelles C with BCX  (Read 7834 times)

post from old forum

  • Guest
Using Pelles C with BCX
« on: September 13, 2004, 08:50:06 PM »
Hi,
I'm a BCX user (Basic to C converter) and I'm tryinto to compile some lcc compatible programs with PellesC.
When generating GUI app BCX emitts winsock2.h, but pellesC complains about it and reports more than 100 errors similar to:
C:\PellesC\\INCLUDE\\WIN\winsock2.h(70): error: Macro redefinition of 'FD_SET'.

Another problem semas to be with default arguments for the functions:

Sample:
HWND BCX_Form(char*,int=0,int=0,int=250,int=150,int=0,int=0);

Is it allowed in PellesC or maybe I'm doing somethiong wrong?

Thank you,
Ljubisa Knezevic

post from old forum

  • Guest
Using Pelles C with BCX
« Reply #1 on: September 13, 2004, 08:50:43 PM »
Hello,
The problem is that windows.h contains the following definition (from Microsoft):

#if (_WIN32_WINNT >= 0x0400)
#include <winsock2.h>
#include <mswsock.h>
#else
#include <winsock.h>
#endif

This means that, by default, winsock.h is included. winsock.h can't be mixed with winsock2.h. The simplest solution is to define _WIN32_WINNT to get winsock2.h instead. One way of doing it is to modify the command line for pocc:

pocc ... -D_WIN32_WINNT=0x0400 ...

Optional arguments (...int=250, int=150,...) are supported and *should* work. Optional arguments are not part of standard C, so you need to specify the /Zx option to enable support for them.

You are also calling strupr() somewhere, so you need to specify the /Go option to POCC - this will map strupr() to it's real name in Pelles C: _strupr().

Pelle

post from old forum

  • Guest
Using Pelles C with BCX
« Reply #2 on: September 13, 2004, 08:51:08 PM »
Ljubisa:
Replace the double backslashes in povars32.bat with single backslashes. For some reason the double backslashes cause problems, not always but often.

Robert Wishlaw

post from old forum

  • Guest
Using Pelles C with BCX
« Reply #3 on: September 13, 2004, 08:51:29 PM »
Thank you both!
Problem solved.

Ljubisa