昨日に続き質問ですLNK2019.エラー
Posted: 2012年3月22日(木) 13:13
VC++2010,OSwindows7
初心者です。
下記のエラーが出て、解決方法が知りたいです。
よろしくお願いいたします。
1>------ ビルド開始: プロジェクト: main, 構成: Debug Win32 ------
1> main.cpp
1>LIBCMTD.lib(crt0.obj) : error LNK2019: 未解決の外部シンボル _main が関数 ___tmainCRTStartup で参照されました。
1>C:\Users\kono\Desktop\C言語\main\Debug\main.exe : fatal error LNK1120: 外部参照 1 が未解決です。
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========
初心者です。
下記のエラーが出て、解決方法が知りたいです。
よろしくお願いいたします。
1>------ ビルド開始: プロジェクト: main, 構成: Debug Win32 ------
1> main.cpp
1>LIBCMTD.lib(crt0.obj) : error LNK2019: 未解決の外部シンボル _main が関数 ___tmainCRTStartup で参照されました。
1>C:\Users\kono\Desktop\C言語\main\Debug\main.exe : fatal error LNK1120: 外部参照 1 が未解決です。
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========
//main.cpp
#include "main.h"
//ループで必ず行う3大処理
int ProcessLoop(){
if(ProcessMessage()!=0)
return -1;//プロセス処理がエラーなら-1を返す
if(ClearDrawScreen()!=0)
return -1;//画面クリア処理がエラーなら-1を返す
GetHitKeyStateAll_2();//現在のキー入力処理を行う
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
ChangeWindowMode(TRUE);//ウィンドウモード
if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化
load_t->load();//データのロード
while(ProcessLoop()==0){//メインループ
//計算処理
//描画処理
graph_t->graph_main();//グラフ処理メイン
if(CheckStateKey(KEY_INPUT_ESCAPE)==1)
break;//エスケープが入力されたらブレイク
ScreenFlip();//裏画面反映
}
DxLib_End();//DXライブラリ終了処理
return 0;
}
//main.h
#ifndef INCLUDE_MAIN_H//インクルードガード
#define INCLUDE_MAIN_H
#include "DxLib.h"
#include "math.h"
#include "key.h"
#include "load.h"
#include "player.h"
#include "graph.h"
//実体化
Load *load_t;
Player *player_t;
Graph *graph_t;
//現在のキー入力処理を行う
int GetHitKeyStateAll_2();
//受け取ったキー番号の現在の入力状態を返す
int CheckStateKey(unsigned char Handle);
#endif
//Player.cpp
#include "player.h"
int Player::PlayerInitialize( double x, double y, int cnt, int power, int point, int score, int num, int mutekicnt, int shot_mode, int money, int img,
bool slow, bool shootflag){
Player::x = SCREEN_HIGH;
Player::y = SCREEN_WIDE-64.0;
return 0;
}
//player.h
#ifndef INCLUDE_PLAYER_H
#define INCLUDE_PLAYER_H
#define SCREEN_WIDE 640.0
#define SCREEN_HIGH 320.0
//クラスの定義
class Player
{
private:
double x,y; //座標
int cnt; //カウンタ
int power; //パワー
int point; //ポイント
int score; //スコア
int num; //残機数
int mutekicnt; //無敵状態とカウント
int shot_mode; //ショットモード
int money; //お金
int img;//画像
bool slow; //スローかどうか
bool ShootFlag;
public:
//プレイヤーの初期化
int PlayerInitialize( double x, double y, int cnt, int power, int point, int score, int num, int mutekicnt, int shot_mode, int money,
int img, bool slow, bool shootflag);
};
#endif
//load.cpp
#include "load.h"
void Load::load(){
int img_ch[2][12];//キャラ画像読み込み
LoadDivGraph( "../Sh/img/0.png" , 12 , 4 , 3 , 73 , 73 , &img_ch[2][12] );
}
//load.h
#ifndef INCLUDE_LOAD_H
#define INCLUDE_LOAD_H
#include "DxLib.h"
class Load
{
public:
void load(); //ロード関数
};
#endif
//graph.cpp
#include "graph.h"
void Graph::graph_ch(){
int img = 0;//画像
int img_ch[2][12];
float x = 0.0; //座標
float y = 0.0;
DrawRotaGraphF( x, y,1.0f,0.0f, img_ch[0][img],TRUE);
}
void Graph::graph_main(){
graph_ch();//キャラクタ描画
}
//graph.h
#ifndef INCLUDE_GRAPH_H
#define INCLUDE_GRAPH_H
#include "DxLib.h"
class Graph
{
public:
void graph_ch();//キャラクター描画関数
void graph_main();//描画メイン制御
};
#endif