Visual Studio 2015 Enterprise를 사용하여 소스 코드에서 응용 프로그램을 컴파일하려고합니다. 나는 몇 가지 문제에 봉착했다.BOOL이 데이터 형식으로 인식되지 않습니다. (C ...?)
컴파일하려고하면 BOOL이 정의되지 않은 유형과 관련된 몇 가지 오류가 발생합니다. 나는 winmindef.h와 windef.h를 포함 시키려고 노력하지 않았다. 내가, 내가이 (가) .H 파일에 다음을 포함 할 때 도움이된다면, 문제가 계속
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
typedef int BOOL;
을 해결되지
void GetCheatName (int CheatNo, char * CheatName, int CheatNameLen);
BOOL LoadCheatExt (char * CheatName, char * CheatExt, int MaxCheatExtLen);
void RefreshCheatManager (void);
void SaveCheatExt (char * CheatName, char * CheatExt);
BOOL TreeView_GetCheckState(HWND hwndTreeView, HTREEITEM hItem);
BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck);`
: 여기에 오류가 발생 코드에서 함수 선언의 일부입니다 PJ64를 컴파일하려고 시도하고 컴파일하기 위해 일부 설정을 변경해야 할 수도 있지만 어느 것이 확실하지 않습니다.
아무런 도움이 필요하지 않습니다.
--- 업데이트 --- 여기
는 전체 컴파일 에러 (필자는 경고의 대부분을 생략 한)입니다 : 내가 컴파일하려고 프로젝트1>cl : Command line warning D9007: '/Gm' requires '/Zi or /ZI'; option ignored
1> Cheat.c
1>Cheat.c(55): error C2059: syntax error: '<parameter-list>'
1>Cheat.c(56): error C2059: syntax error: '{'
1>Cheat.c(233): warning C4267: '=': conversion from 'size_t' to 'WORD', possible loss of data
1>Cheat.c(326): warning C4267: '=': conversion from 'size_t' to 'WORD', possible loss of data
1>Cheat.c(346): warning C4267: '=': conversion from 'size_t' to 'WORD', possible loss of data
1>Cheat.c(982): error C2059: syntax error: '<parameter-list>'
1>Cheat.c(998): error C2059: syntax error: '{'
1>Cheat.c(999): error C2449: found '{' at file scope (missing function header?)
1>Cheat.c(1012): error C2059: syntax error: '}'
전체 코드는 찾을 수 있습니다 here.
이것은 컴파일되어 위의 오류가 발생하는 코드의 -part-입니다. 나는 여기에 포함하기에는 너무 길기 때문에 대다수의 코드를 남겼다. 어떤 라인이 오류를 던 졌는지에 대한 의견을 남겼습니다.
#include <Windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <windef.h>
#include <stdio.h>
#include "main.h"
#include "cheats.h"
#include "cpu.h"
#include "resource.h"
#define UM_CHECKSTATECHANGE (WM_USER + 100)
#define UM_CHANGECODEEXTENSION (WM_USER + 101)
#define IDC_MYTREE 0x500
#define MaxCheats 300
#define SelectCheat 1
#define EditCheat 2
#define NewCheat 3
HWND hManageWindow = NULL;
HWND hSelectCheat, hAddCheat, hCheatTree;
CHEAT_CODES Codes[MaxCheats];
int NoOfCodes;
void GetCheatName (int CheatNo, char * CheatName, int CheatNameLen);
BOOL LoadCheatExt (char * CheatName, char * CheatExt, int MaxCheatExtLen);
void RefreshCheatManager (void);
void SaveCheatExt (char * CheatName, char * CheatExt);
BOOL TreeView_GetCheckState(HWND hwndTreeView, HTREEITEM hItem); //(line 55, error thrown.)
BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck); //(line 56)
LRESULT CALLBACK ManageCheatsProc (HWND, UINT, WPARAM, LPARAM);
void ApplyCheats (void) {
//lots 'o code
}
BOOL CheatActive (char * Name) {
//more code
}
LRESULT CALLBACK CheatsCodeExProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
//Too much code to contain in this post...
}
LRESULT CALLBACK CheatsCodeQuantProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
//code
}
//Because of the inmensity of code, I will skip to the lines that throw errors.
BOOL TreeView_GetCheckState(HWND hwndTreeView, HTREEITEM hItem) { //line 982, error thrown.
//code here
}
BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck) //line 999, error thrown
{ //line 1000, error thrown
//Lots o code
} // line 1013, error thrown
더 많은 코드가 필요한 경우 기꺼이 게시 할 예정입니다.
죄송합니다. windef.h를 포함 시키려고했으나 수정하지 않았거나 winmindef.h를 포함하지 않았습니다. – Jack
그 이유는 표준/올바른 'bool' 유형을 사용할 수없는 이유인데 그 이유는 그 못생긴 typedef/매크로/뭐'BOOL'? 그리고 '진실'과 '거짓'을 정의하면 - 왜? 이 코드는 나에게 매우 나쁜 C처럼 보입니다. * 좋은 * C++로 업그레이드하십시오. –
'WinDef.h '를 사용해 보셨습니까? – tadman