重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー LNK2005 "void __cdecl Control_Action(void)" (?Control_Action@@YAXXZ) は既に Action_Control.obj で定義されています。 GameProg C:\Users\sekai\Desktop\3Dプログラミング\test.obj 1
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー LNK2005 "struct DxLib::tagVECTOR pos" (?pos@@3UtagVECTOR@DxLib@@A) は既に Action_Control.obj で定義されています。 GameProg C:\Users\sekai\Desktop\3Dプログラミング\test.obj 1
上のようなエラーが出てしまいます。ネットを使い調べたのですが、あまり情報がなく、わかりませんでした。
分かる方がいれば、教えてください<(_ _)>
/*test.cpp*/
#define GLOBAL_INSTANCE
#include "GV.h"
#include "Action_Control.cpp"
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
ChangeWindowMode(TRUE);
if (DxLib_Init() == -1 || SetDrawScreen(DX_SCREEN_BACK) != 0) return -1;
SetGraphMode(1200, 800, 32);
Load_Main();
if (model == -1)return-1;
while (!ScreenFlip() && !ProcessMessage() && !ClearDrawScreen() && !Get_Key()) {
DrawBox(0, 0, 1200, 800, GetColor(255, 255, 255), TRUE);
Control_Action();
MV1DrawModel(model);
if (Key[KEY_INPUT_UP])pos.z += 4.0f;
if (Key[KEY_INPUT_DOWN])pos.z -= 4.0f;
if (Key[KEY_INPUT_RIGHT])pos.x += 4.0f;
if (Key[KEY_INPUT_LEFT])pos.x -= 4.0f;
if (CheckHitKey(KEY_INPUT_RETURN)) {
break;
}
}
//WaitKey();
DxLib_End();
}
/*Load.cpp*/
//素材ロード
void Load_Main() {
model = MV1LoadModel("3Dモデル//Player//PC.mv1"); //モデルの読み込み 戻り値int型のモデルハンドル
}
//キーボード入力
int Get_Key() {
char tmpKey[256];
GetHitKeyStateAll(tmpKey);
for (int i = 0; i < 256; i++) {
Key[i]++;
if (tmpKey[i] != 0) {
Key[i]++;
}
else {
Key[i] = 0;
}
}
return 0;
}
/*Action_Control.cpp*/
#include "GV.h"
extern VECTOR pos = VGet(600.0f, 300.0f, -400.0f);
void Control_Action() {
MV1SetPosition(model, pos);
}
[/coke]
/*GV.h*/
[code]
#pragma once
#include "DxLib.h"
#include <stdio.h>
#ifdef GLOBAL_INSTANCE
#define GLOBAL
#else
#define GLOBAL extern
#endif
#include "function.h"
//変数定義
GLOBAL int model;
GLOBAL char Key[256];