c++ frage

Previous topic - Next topic

Heiko

"expected unqualified-id before string constant"

was bedeutet diese fehlermeldung, hab gegooglet, aber leider nichts gefunden, was es mir erklären würde.

in diesem zusammenhang

Code (glbasic) Select
INLINE
extern "C" {
void  FreeLibraryAndExitThread(xors);
}
ENDINLINE

Kitty Hello

xors - was für ein Typ ist das?

Heiko

#2
Code (glbasic) Select
FUNCTION foo:
ENDFUNCTION

INLINE
#define _winbase_h_
DECLARE(FreeLibraryAndExitThread,"winbase.h",(const char*, int),void);
DECLARE(GetModuleHandleA,"winbase.h",(const char*),const char*);
extern "C"
using namespace std;
int main()
{
     const char* hMod = GetModuleHandleA("Xors3d.dll");

     FreeLibraryAndExitThread(hMod,0);

}

ENDINLINE




compilieren geht, nur stürzt sofort ab

Schranz0r

wird so auch nich funzen !

Header ist :

#include "datei.h"

oder

#include <datei.h>

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

Heiko

#4
GERNOT: hast ne PM.


mmmm da spuckt es jetzt haufen fehlercodes aus.

habs so probiert.

Code (glbasic) Select
INLINE
#include "winbase.h"
DECLARE(FreeLibraryAndExitThread,"windows.h",(const char*, int),bool);
DECLARE(GetModuleHandleA,"windows.h",(const char*),const char*);
DECLARE(SendMessage,"windows.h",(const char*, const char*, int, int),long);

extern "C"
using namespace std;
int main()
{

    const char* hModa = GetModuleHandleA("Xors3d.dll");
     SendMessage(hModa, "WM_CLOSE", 0, 0L);

     const char* hMod = GetModuleHandleA("Squall.dll");
     SendMessage(hMod, "WM_CLOSE", 0, 0L);
   RETURN 0;
}

ENDINLINE



bei "windows.h"

Code (glbasic) Select
In file included from /mingw/lib/gcc/mingw32/3.4.5/../../../../include/windef.h:253,
                 from /mingw/lib/gcc/mingw32/3.4.5/../../../../include/windows.h:48,
                 from C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:58:
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:106: error: expected unqualified-id before "short"
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:106: error: expected initializer before "short"
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:107: error: expected unqualified-id before "short"
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:107: error: expected initializer before "short"
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:59: error: `bool (*__GLBASIC__::FreeLibraryAndExitThread)(const char*, int)' redeclared as different kind of symbol
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1313: error: previous declaration of `void __GLBASIC__::FreeLibraryAndExitThread(__GLBASIC__::HINSTANCE__*, long unsigned int)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:59: error: declaration of `bool (*__GLBASIC__::FreeLibraryAndExitThread)(const char*, int)'
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1313: error: conflicts with previous declaration `void __GLBASIC__::FreeLibraryAndExitThread(__GLBASIC__::HINSTANCE__*, long unsigned int)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:60: error: `const char*(*__GLBASIC__::GetModuleHandleA)(const char*)' redeclared as different kind of symbol
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1404: error: previous declaration of `__GLBASIC__::HINSTANCE__* __GLBASIC__::GetModuleHandleA(const __GLBASIC__::CHAR*)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:60: error: declaration of `const char*(*__GLBASIC__::GetModuleHandleA)(const char*)'
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1404: error: conflicts with previous declaration `__GLBASIC__::HINSTANCE__* __GLBASIC__::GetModuleHandleA(const __GLBASIC__::CHAR*)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:61: error: `long int (*__GLBASIC__::SendMessageA)(const char*, const char*, int, int)' redeclared as different kind of symbol
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winuser.h:3914: error: previous declaration of `__GLBASIC__::LRESULT __GLBASIC__::SendMessageA(__GLBASIC__::HWND__*, __GLBASIC__::UINT, __GLBASIC__::WPARAM, __GLBASIC__::LPARAM)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:61: error: declaration of `long int (*__GLBASIC__::SendMessageA)(const char*, const char*, int, int)'
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winuser.h:3914: error: conflicts with previous declaration `__GLBASIC__::LRESULT __GLBASIC__::SendMessageA(__GLBASIC__::HWND__*, __GLBASIC__::UINT, __GLBASIC__::WPARAM, __GLBASIC__::LPARAM)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::main()':
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:68: error: cannot convert `__GLBASIC__::HINSTANCE__*' to `const char*' in initialization
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:69: error: cannot convert `const char*' to `__GLBASIC__::HWND__*' for argument `1' to `__GLBASIC__::LRESULT __GLBASIC__::SendMessageA(__GLBASIC__::HWND__*, __GLBASIC__::UINT, __GLBASIC__::WPARAM, __GLBASIC__::LPARAM)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:72: error: cannot convert `__GLBASIC__::HINSTANCE__*' to `const char*' in initialization
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:73: error: cannot convert `const char*' to `__GLBASIC__::HWND__*' for argument `1' to `__GLBASIC__::LRESULT __GLBASIC__::SendMessageA(__GLBASIC__::HWND__*, __GLBASIC__::UINT, __GLBASIC__::WPARAM, __GLBASIC__::LPARAM)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:78: error: `RETURN' was not declared in this scope
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:78: error: expected `;' before numeric constant
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp: At global scope:
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: `int WinMain' redeclared as different kind of symbol
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:84: error: previous declaration of `int WinMain(HINSTANCE__*, HINSTANCE__*, TCHAR*, int)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: declaration of `int WinMain'
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:84: error: conflicts with previous declaration `int WinMain(HINSTANCE__*, HINSTANCE__*, TCHAR*, int)'
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: use of `HINSTANCE' is ambiguous
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:79: error:   first declared as `typedef struct HINSTANCE__*HINSTANCE' here
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/windef.h:290: error:   also declared as `typedef struct __GLBASIC__::HINSTANCE__*__GLBASIC__::HINSTANCE' here
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: `HINSTANCE' was not declared in this scope
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: use of `HINSTANCE' is ambiguous
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:79: error:   first declared as `typedef struct HINSTANCE__*HINSTANCE' here
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/windef.h:290: error:   also declared as `typedef struct __GLBASIC__::HINSTANCE__*__GLBASIC__::HINSTANCE' here
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: `HINSTANCE' was not declared in this scope
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: use of `LPSTR' is ambiguous
C:/Program Files/GLBasic/Compiler/platform/Include/glb.h:69: error:   first declared as `typedef TCHAR*LPSTR' here
/mingw/lib/gcc/mingw32/3.4.5/../../../../include/winnt.h:108: error:   also declared as `typedef __GLBASIC__::CHAR*__GLBASIC__::LPSTR' here
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: `LPSTR' was not declared in this scope
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:104: error: expected primary-expression before "int"
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:105: error: initializer expression list treated as compound expression
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:105: error: expected `,' or `;' before '{' token
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren



und bei "winbase.h"

Code (glbasic) Select
compiling:
In file included from C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:58:
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:597: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:617: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:638: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:643: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:646: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:647: error: `LPTHREAD_START_ROUTINE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:648: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:653: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:654: error: `LPTHREAD_START_ROUTINE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:657: error: `EXCEPTION_RECORD' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:668: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:671: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:675: error: `LPVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:724: error: `PBYTE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:744: error: `PBYTE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:759: error: `LIST_ENTRY' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:766: error: `LONG' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:767: error: `LONG' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:799: error: `CHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:800: error: `CHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:811: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:812: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:817: error: `LARGE_INTEGER' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:819: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:837: error: `CHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:838: error: `CHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:842: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:843: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:850: error: expected `;' before "union"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:856: error: expected `;' before "DUMMYUNIONNAME"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:858: error: `PVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:859: error: `PVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:876: error: `LONG' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:877: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:879: error: `LONG' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:880: error: `WCHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:882: error: `LONG' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:932: error: `PVOID' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:937: error: expected `;' before "union"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:948: error: expected `;' before "DUMMYUNIONNAME"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:956: error: `CHAR' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1024: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1025: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1026: error: typedef `__GLBASIC__::BOOL' is initialized (use __typeof__ instead)
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1026: error: `CALLBACK' was not declared in this scope
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1026: error: `ENUMRESLANGPROC' was not declared in this scope
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1026: error: expected `,' or `;' before '(' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1027: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1028: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1029: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1030: error: typedef `__GLBASIC__::LONG' is initialized (use __typeof__ instead)
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1030: error: `CALLBACK' was not declared in this scope
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1030: error: `PTOP_LEVEL_EXCEPTION_FILTER' was not declared in this scope
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1030: error: expected `,' or `;' before '(' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1031: error: `PTOP_LEVEL_EXCEPTION_FILTER' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1033: error: expected `)' before '*' token
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1045: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1046: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1047: error: `HFILE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1048: error: `HFILE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1049: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1050: error: `HFILE' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1051: error: `UINT' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1052: error: `UINT' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1054: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1055: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1056: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1060: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1061: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1066: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1067: error: `ATOM' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1068: error: `ATOM' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1069: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1076: error: `WINAPI' does not name a type


und so weiter

Code (glbasic) Select
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1250: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1251: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1252: error: expected constructor, destructor, or type conversion before "void"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1253: error: expected constructor, destructor, or type conversion before "void"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1254: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1255: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1256: error: `WINAPI' does not name a type


C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1326: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1327: error: expected initializer before "GetCommandLineW"
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1328: error: `WINAPI' does not name a type
C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1329: error: `WINAPI' does not name a type


C:/Users/nutzer/Documents/GLBasic/blanko/winbase.h:1945: error: `WINAPI' does not name a type
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::main()':
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:78: error: `RETURN' was not declared in this scope
C:\Users\nutzer\AppData\Local\Temp\glbasic\gpc_temp0.cpp:78: error: expected `;' before numeric constant


Schranz0r

Richtig das Handle bekommt man auch raus mit der WinAPI ;)

Ich schau gleich mal ;)
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