GLBasic forum

Other languages => GLBasic - de => Topic started by: Schranz0r on 2008-Jan-19

Title: windows.h fehler in GLB
Post by: Schranz0r on 2008-Jan-19
So, das gibt mir GLBasic aus, wenn ich die windows.h includiere !


Code (glbasic) Select
In file included from C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:246,
                 from C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:48,
                 from C:/DOKUME~1/SCHRAN~1/LOKALE~1/Temp/glbasic/gpc_temp1.cpp:15:
C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:78: error: expected unqualified-id before "short"
C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:78: error: expected initializer before "short"
C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:79: error: expected unqualified-id before "short"
C:/Programme/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:79: error: expected initializer before "short"
einer ne Idee wieso?
Title: windows.h fehler in GLB
Post by: Quentin on 2008-Jan-19
ähhh ich nehme an, daß beim Compilieren sowieso die windows.h von gcc includiert wird.

wie sieht denn dein Quelltext von GLB aus und die windows.h, die du einbindest?
Title: windows.h fehler in GLB
Post by: Schranz0r on 2008-Jan-19
GLB Quelltext(Seperate gbas-datei):

Code (glbasic) Select
INLINE
#include
ENDINLINE
die windows.h:

Code (glbasic) Select
/*
windows.h - main header file for the Win32 API

Written by Anders Norlander

This file is part of a free library for the Win32 API.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*/
#ifndef _WINDOWS_H
#define _WINDOWS_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif

/* translate GCC target defines to MS equivalents. Keep this synchronized
   with winnt.h. */
#if defined(__i686__) && !defined(_M_IX86)
#define _M_IX86 600
#elif defined(__i586__) && !defined(_M_IX86)
#define _M_IX86 500
#elif defined(__i486__) && !defined(_M_IX86)
#define _M_IX86 400
#elif defined(__i386__) && !defined(_M_IX86)
#define _M_IX86 300
#endif
#if defined(_M_IX86) && !defined(_X86_)
#define _X86_
#elif defined(_M_ALPHA) && !defined(_ALPHA_)
#define _ALPHA_
#elif defined(_M_PPC) && !defined(_PPC_)
#define _PPC_
#elif defined(_M_MRX000) && !defined(_MIPS_)
#define _MIPS_
#elif defined(_M_M68K) && !defined(_68K_)
#define _68K_
#endif

#ifdef RC_INVOKED
/* winresrc.h includes the necessary headers */
#include
#else

#include
#include
#include
#include
#if !(defined NOGDI || defined  _WINGDI_H)
#include
#endif
#ifndef _WINUSER_H
#include
#endif
#ifndef _WINNLS_H
#include
#endif
#ifndef _WINVER_H
#include
#endif
#ifndef _WINNETWK_H
#include
#endif
#ifndef _WINREG_H
#include
#endif
#ifndef _WINSVC_H
#include
#endif

#ifndef WIN32_LEAN_AND_MEAN
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifndef NOGDI
#include
#include
#endif
#if defined(Win32_Winsock)
#warning "The  Win32_Winsock macro name is deprecated.\
    Please use __USE_W32_SOCKETS instead"
#ifndef __USE_W32_SOCKETS
#define __USE_W32_SOCKETS
#endif
#endif
#if defined(__USE_W32_SOCKETS) || !(defined(__CYGWIN__) || defined(__MSYS__) || defined(_UWIN))
#if (_WIN32_WINNT >= 0x0400)
#include
/*
 * MS likes to include mswsock.h here as well,
 * but that can cause undefined symbols if
 * winsock2.h is included before windows.h
 */
#else
#include
#endif /*  (_WIN32_WINNT >= 0x0400) */
#endif
#ifndef NOGDI
#if !defined (__OBJC__)
#if (__GNUC__ >= 3) || defined (__WATCOMC__)
#include
#endif
#endif /* __OBJC__ */
#endif

#endif /* WIN32_LEAN_AND_MEAN */

#endif /* RC_INVOKED */

#ifdef __OBJC__
/* FIXME: Not undefining BOOL here causes all BOOLs to be WINBOOL (int),
   but undefining it causes trouble as well if a file is included after
   windows.h
*/
#undef BOOL
#endif

#endif
Title: windows.h fehler in GLB
Post by: Quentin on 2008-Jan-19
Das Problem ist wohl, daß sich die Include-Dateien je nach C-Compiler mehr oder minder stark unterscheiden. Ich habe jetzt mal alle Header-Dateien vom Microsoft-Platform-SDK in das GLB-Include-Verzeichnis kopiert. Damit kann man das dann zumindest fehlerfrei kompilieren.

hier eine Beschreibung mit Download-Links:

http://en.wikipedia.org/wiki/Microsoft_Windows_SDK

Nur mal so aus Neugier. Was willst machen? Gui-Wrapper? ;)
Title: windows.h fehler in GLB
Post by: Schranz0r on 2008-Jan-19
Owned :D
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-29
Hi,

I am getting this error, is the above windows.h more compatible with GLB?
Title: Re: windows.h fehler in GLB
Post by: Kitty Hello on 2011-Aug-29
with the header pack from GLBasic you get this error?
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-29
Unfortunately yes, the exact same error...

Code (glbasic) Select
In file included from C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:246,
                 from C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:48,
                 from C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/GL/wglew.h:69,
                 from C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/GL/glew.c:34,
                 from C:\Users\Dad\AppData\Local\Temp\glbasic\gpc_temp1.cpp:54:
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:82: error: expected unqualified-id before "short"
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:82: error: expected initializer before "short"
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:84: error: expected unqualified-id before "short"
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:84: error: expected initializer before "short"


I am trying to get Glew working(porting a 3D engine to GLB), so that I can use "glDeleteBuffers" but I got stuck at the first hurdle.
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-30
I don't know if its related but I am getting this conflict error too...
Code (glbasic) Select

C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:284: error: redefinition of `struct HINSTANCE__'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:80: error: previous definition of `struct HINSTANCE__'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:284: error: conflicting declaration 'typedef int*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:80: error: 'HINSTANCE' has a previous declaration as `typedef struct HINSTANCE__*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:284: error: declaration of `typedef int*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:80: error: conflicts with previous declaration `typedef struct HINSTANCE__*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:284: error: declaration of `typedef int*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:80: error: conflicts with previous declaration `typedef struct HINSTANCE__*HINSTANCE'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:292: error: redefinition of `struct HWND__'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:81: error: previous definition of `struct HWND__'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:292: error: conflicting declaration 'typedef int*HWND'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:81: error: 'HWND' has a previous declaration as `typedef struct HWND__*HWND'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:292: error: declaration of `typedef int*HWND'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:81: error: conflicts with previous declaration `typedef struct HWND__*HWND'
C:/Program Files (x86)/GLBasic/Compiler/platform/Win32/Bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:292: error: declaration of `typedef int*HWND'
C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:81: error: conflicts with previous declaration `typedef struct HWND__*HWND'


It seems like GLB is unaware of the presence of certain windows headers and it trying to recreate some windows defines?

P.S. I apologise that this is in a German forum, as its the only related thread I could find. A mod could move it anyone wants it moved.  ;)
Title: Re: windows.h fehler in GLB
Post by: Kitty Hello on 2011-Aug-30
yes. GLBasic is not using the windows headers for the main files to get rid of overhead data.
What exactly are you trying to use with windows.h?
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-30
I am trying to get a 3D lib running with GLB, it uses "glDeleteBuffers", so I need to load some GL extensions. I've tried GLEW and GLee, both are showing the same conflicting windows headers errors unfortunately. I don't think the GLB.H is properly aware of windows.h at compile time or glb.h has been added to the compile before windows.h(and the other headers) have had a go 1st, so its unaware of the old windows.h #defines?
Title: Re: windows.h fehler in GLB
Post by: Kitty Hello on 2011-Aug-30
can you just declare the stuff that is missing?
I think getting windows.h working is quite a lot of work.
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-30
You mean manually add the extensions that are missing? I have about 5 extensions in total that I need... its an idea I suppose.

I could create a dynamic lib or strip down glb.h(not a great choice though).

I'll do some reading up on linking to GL extensions and see what's involved.
Title: Re: windows.h fehler in GLB
Post by: Kitty Hello on 2011-Aug-30
just copy the prototypes and declare some replacement typedefs that have the same size (int/float)
Title: Re: windows.h fehler in GLB
Post by: Schranz0r on 2011-Aug-31
use this:

Code (glbasic) Select

INLINE

}
#define HINSTANCE W32HINSTANCE
#define HINSTANCE__ W32HINSTANCE__
#undef LPSTR
#undef DECLARE_HANDLE
#undef LPCTSTR
#undef DWORD
#undef LPWSTR
#undef LPCWSTR
#define HWND W32HWND
#define HWND__ W32HWND__
#define HANDLE W32HANDLE
#undef MAX_PATH
#undef TCHAR
#define WIN32_LEAN_AND_MEAN
#define WinMain WinMain2
#include <windows.h>
namespace __GLBASIC__ {

//do stuff here

ENDINLINE
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-31
Hi guys, lots of good stuff there, I'll try Schranz0rs fix first, then Gernots if that falls through.  :good:
Title: Re: windows.h fehler in GLB
Post by: bigsofty on 2011-Aug-31
Schranz0rs fix is working great, I have a tonne of other errors but there not related to this hurdle.

Thanks again!
Title: Re: windows.h fehler in GLB
Post by: Schranz0r on 2011-Sep-04
no problem :D
(was Gernots fix) ;)