windows.h fehler in GLB

Previous topic - Next topic

Schranz0r

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?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Quentin

ä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?

Schranz0r

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
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

Quentin

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? ;)

Schranz0r

I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

bigsofty

Hi,

I am getting this error, is the above windows.h more compatible with GLB?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

with the header pack from GLBasic you get this error?

bigsofty

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.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

bigsofty

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.  ;)
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

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?

bigsofty

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?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

can you just declare the stuff that is missing?
I think getting windows.h working is quite a lot of work.

bigsofty

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.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

just copy the prototypes and declare some replacement typedefs that have the same size (int/float)

Schranz0r

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
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard