I have some code that compiled find with version 4.5. I just downloaded 5.01 and am getting many redefinition errors like:
C:\PellesC\Include\Win\ws2def.h(39): error #1050: Macro redefinition of 'AF_IPX'.
C:\PellesC\Include\Win\ws2def.h(63): error #1050: Macro redefinition of 'AF_MAX'.
C:\PellesC\Include\Win\ws2def.h(94): error #1050: Macro redefinition of 'SO_DONTLINGER'.
C:\PellesC\Include\Win\ws2def.h(341): error #1050: Macro redefinition of 'IN_CLASSA'.
Am I missing something or is this a problem with winsock2.h?
Attached is error winsock2.txt with all the errors listed
winsock2.h has always been tricky in the world of Microsoft, but if you include it *before* windows.h (or even skip windows.h) it usually works...
#include <winsock2.h>
#include <windows.h>
I removed windows.h but now I am getting many errors with commctrl.h
Moving commctrl.h before or after other header files does not solve anything.
Basically you can not use standard windows header files in version 5.
Quote from: zzen on November 13, 2008, 01:46:35 AM
I removed windows.h but now I am getting many errors with commctrl.h
Moving commctrl.h before or after other header files does not solve anything.
Basically you can not use standard windows header files in version 5.
Pelle said
============
winsock2.h has always been tricky in the world of Microsoft, but if you include it *before* windows.h
============
Try again.
John
As stated before, lots of errors. Attached is the errors received.
list of header files:
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <winsock2.h>
#include <commctrl.h>
#include <windows.h>
#include <stdlib.h>
//#include <malloc.h>
#include <time.h>
#include <direct.h>
#include <math.h>
#include <process.h>
#include "getdata.h"
#include "getdataf.h"
#include "scaldate.h"
#include "fileini.h"
#include "getdatares.h"
Correction I hit "rebuild all" the errors are created from the first souce file.The new errors have nothing to do with winsock2.h. error list is attached.
Header list:
#include <commctrl.h>
#include <windows.h>
#include <shellapi.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <io.h>
#include <process.h>
#include <math.h>
#include "fileini.h"
#include "getdata.h"
#include "getdataf.h"
#include "scaldate.h"
windows.h must come before most other windows headers, except winsock2.h of course, because including windows.h first, defines many of the things that other windows headers need.
#include <windows.h>
#include <commctrl.h>
John
Moving the windows.h header was the fix!
Thanks for all the help