我正在使用 DragonFireSDK 制作一个应用程序,我想用 .cpp 和 .h 文件组织我的数千行应用程序
我在尝试做事情时遇到很多错误
所以我的 app.cpp (main, required one) 看起来像这样
代码:
#include "DragonFireSDK.h"
#include "SaveData.h"
#include "Structures.h"
#include "Definitions.h"
#include "Variables.h"
#include "SaveData.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Functions.cpp"
#include "AppMain.cpp"
#include "AppExit.cpp"
#include "OnTimer.cpp"
#include "SaveData.h" 到 #include "Variables.h" 都有类似代码:
#ifndef _HeaderName
#define _HeaderName
//STUFF HERE LIKE
#define player1 0
#define player2 1
//OR
typedef struct _number {
int view;
int number;
bool able;
int opacity;
};_number number[4];
//OR
int whoseturn;
int bet[5];
bool reachedmax[5];
int playerimg[5];
#endif
现在我可能已经做错了,但这里还有一些......我的 AppMain.cpp、OnTimer.cpp 等看起来像这样(AppMain() 等也是必需的函数)代码:
#include "DragonFireSDK.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "Definitions.h"
#include "Structures.h"
#include "Variables.h"
#include "SaveData.h"
#include "Functions.cpp"
void AppMain() {
//STUFF HERE
};
现在这就是我认为问题所在... Functions.cpp 代码:
#include "DragonFireSDK.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "SaveData.h"
#include "Structures.h"
#include "Definitions.h"
#include "Variables.h"
//SOME FUNCTIONS
void SavePlayerMoney();
void SetInfo (int idnum, bool actuallyset = false);
void SwitchButton (int idnum, bool makeactive=true);
void DisableButton (int idnum);
double round (double number);
void SavePlayerMoney() {
//...
}
void SetInfo(int idnum, bool actuallyset) {
//...
}
void SwitchButton(int idnum, bool makeactive) {
//...
}
void DisableButton(int idnum){
//...
}
现在我想如果修复了所有的东西,我得到的错误......代码:
1>AppMain.obj : error LNK2005: "void __cdecl SwitchButton(int,bool)" (?SwitchButton@@YAXH_N@Z) already defined in App.obj
1>AppMain.obj : error LNK2005: "double __cdecl round(double)" (?round@@YANN@Z) already defined in App.obj
1>AppMain.obj : error LNK2005: "void __cdecl SetInfo(int,bool)" (?SetInfo@@YAXH_N@Z) already defined in App.obj
1>AppMain.obj : error LNK2005: "int __cdecl Digits(int)" (?Digits@@YAHH@Z) already defined in App.obj
非常感谢任何帮助!