gpt4 book ai didi

C2061 语法错误(标识符)

转载 作者:太空狗 更新时间:2023-10-29 17:17:04 30 4
gpt4 key购买 nike

1>cb.c(51): error C2061: syntax error : identifier 'SaveConfiguration'
1>cb.c(51): error C2059: syntax error : ';'
1>cb.c(51): error C2059: syntax error : 'type'
1>cb.c(52): error C2061: syntax error : identifier 'LoadConfiguration'
1>cb.c(52): error C2059: syntax error : ';'
1>cb.c(52): error C2059: syntax error : 'type'
1>cb.c(122): error C2061: syntax error : identifier 'SaveConfiguration'
1>cb.c(122): error C2059: syntax error : ';'
1>cb.c(122): error C2059: syntax error : 'type'
1>cb.c(127): error C2061: syntax error : identifier 'LoadConfiguration'
1>cb.c(127): error C2059: syntax error : ';'
1>cb.c(127): error C2059: syntax error : 'type'
1>
1>Build FAILED.

它只是项目中的一个.c 文件。这是代码:

#define WIN32_LEAN_AND_MEAN

#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <tchar.h>

typedef struct _Configuration
{
int KeyActivate;
int BlockWidth;
int BlockHeight;
double HueStart;
double HueEnd;
double SaturationStart;
double SaturationEnd;
double ValueStart;
double ValueEnd;
} Configuration;

typedef struct _DIBSection
{
HDC ScreenDC;
HDC WindowDC;
HDC MemoryDC;
HBITMAP ScreenBMPHandle;
BITMAP ScreenBMP;
} DIBSection;

typedef struct _Thread
{
HANDLE Handle;
unsigned Id;
} Thread;

typedef struct _Window
{
HANDLE Handle;
HDC DC;
int Width;
int Height;
int Top;
int Left;
} Window;

__declspec ( dllexport ) int Initialize ( void );
unsigned __stdcall Start ( void * Arguments );

void LoadDefaultConfiguration ( Configuration * Config );
bool SaveConfiguration ( Configuration * Config, LPTSTR FilePath );
bool LoadConfiguration ( Configuration * Config, LPTSTR FilePath );

Thread MainThread;
Window Screen;
Configuration Settings;

BOOL WINAPI DllMain ( HINSTANCE Instance, DWORD Reason, LPVOID Reserved )
{
switch ( Reason )
{

case DLL_PROCESS_ATTACH:

// TODO: Load settings from file
LoadDefaultConfiguration ( & Settings );

// Create main thread
MainThread.Handle = (HANDLE) _beginthreadex (
NULL,
0,
Start,
NULL,
0,
& MainThread.Id
);

if ( MainThread.Handle )
{
SetThreadPriority ( MainThread.Handle, THREAD_PRIORITY_BELOW_NORMAL );
}
else
{
MessageBox ( NULL, L"Unable to create main thread; exiting", L"Error", MB_OK );
ExitProcess ( 0 );
}

break;

case DLL_PROCESS_DETACH:

break;

}

return TRUE;
}

__declspec ( dllexport ) int Initialize ( void )
{
return 1;
}

unsigned __stdcall Start ( void * Arguments )
{
return 1;
}

void LoadDefaultConfiguration ( Configuration * Config )
{
Config->BlockHeight = 50;
Config->BlockWidth = 100;
Config->HueEnd = 0.00;
Config->HueStart = 0.00;
Config->KeyActivate = VK_SHIFT;
Config->SaturationEnd = 0.00;
Config->SaturationStart = 0.00;
Config->ValueEnd = 0.00;
Config->ValueStart = 0.00;
}

bool SaveConfiguration ( Configuration * Config, LPTSTR FilePath )
{
return true;
}

bool LoadConfiguration ( Configuration * Config, LPTSTR FilePath )
{
return true;
}

第51行是

bool SaveConfiguration ( Configuration * Config, LPTSTR FilePath );

最佳答案

bool 不是 C 类型。

我怀疑 BOOL 是在某处定义的。

同样适用于 truefalse 的用法。

关于C2061 语法错误(标识符),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3624524/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com