ちゃんと定義したつもりなのです
なのですが、include文を少しいじくるとエラーがどばっと出てきたり
リンカエラーになります
(大量に出るエラーはたぶん関係ない未チェックの奴でしょうけど……むしろそうであることを願います)
コードは以下のものです
SAIS -Iris-.cpp[一部]
#define global_instance
#include "stdafx.h"
#include "SAIS -Iris-.h"
#include "global.h"
#define MAX_LOADSTRING 100
#define ID_EDIT 100
// グローバル変数:
HINSTANCE hInst; // 現在のインターフェイス
TCHAR szTitle[MAX_LOADSTRING]; // タイトル バーのテキスト
TCHAR szWindowClass[MAX_LOADSTRING]; // メイン ウィンドウ クラス名
HWND hEdit;
global.h
#define vt(_n) #_n
#define NUM_DRAWNUM 256
/*Define DrawSwitch of Drawprocess*/
#define _DS _int16
#define _DSFA_XYONLY 0x01
#define _DSFA_RECTMODE 0x02
#define _DSFA_AUTODIVISION 0x03
#define _DSFB_LPCWSTRTYPE 0x10
#define _DSFB_LPTSTRTYPE 0x20
#ifdef global_instance
#define global
#else
#define global extern
#endif
typedef struct{
LPCWSTR lpchtext;
LPCWSTR facename;
int size;
int x;
int y;
int w;
int h;
int flag;
COLORREF bkcolor;
}dp_ts_t;/*for loop process of PrintMessage()*/
global dp_ts_t dp_ts;
#ifdef global_intstance
global dp_ts_t *draw_process_text = new dp_ts[NUM_DRAWNUM];
#else
global dp_ts_t *draw_process_text;
#endif
template <class T>
int _DSF_SEPARATER(HWND hwnd,T x,T y)
{
if((
x == _DSFA_XYONLY ||
x == _DSFA_RECTMODE ||
x == _DSFA_AUTODIVISION) && (
y == _DSFB_LPCWSTRTYPE ||
y == _DSFB_LPTSTRTYPE))
{
return x+y;
}else if((
y == _DSFA_XYONLY ||
y == _DSFA_RECTMODE ||
y == _DSFA_AUTODIVISION) && (
x == _DSFB_LPCWSTRTYPE ||
x == _DSFB_LPTSTRTYPE))
{
return x+y;
}else if((
x == _DSFA_XYONLY ||
x == _DSFA_RECTMODE ||
x == _DSFA_AUTODIVISION) && (
y == _DSFA_XYONLY ||
y == _DSFA_RECTMODE ||
y == _DSFA_AUTODIVISION) || (
x == _DSFB_LPCWSTRTYPE ||
x == _DSFB_LPTSTRTYPE) && (
y == _DSFB_LPCWSTRTYPE ||
y == _DSFB_LPTSTRTYPE))
{
MessageBox(
hwnd,
L"ERROR",
L"The same mode repeats in an argument, and it is appointed",
MB_APPLMODAL);
return -1;
}
}
global int now_state;
#include "defunc.h"
InterfaceA.cpp一部
#include "stdafx.h"
#include "scope of capacity.h"
void initialize()
{
now_state = 0x00;
_DEF_PLUSCONTENTS(L"SAIS -Iris- starts with a test mode.\nAll functions are limited now",L"MS UI Gothic",12,0,0,0,0,RGB(0,0,0));
}
PlusFunction.cpp一部
int _DEF_PLUSCONTENTS(
LPCWSTR lpchText,
LPCWSTR facename,
int size,
int x,
int y,
int w,
int h,
COLORREF bkcolor)
{
for(int i=0;i<NUM_DRAWNUM;i++)
{
if(draw_process_text[i].flag == 0)
{
draw_process_text[i].lpchtext = lpchText;
draw_process_text[i].facename = facename;
draw_process_text[i].size = size;
draw_process_text[i].x = x;
draw_process_text[i].y = y;
draw_process_text[i].w = w;
draw_process_text[i].h = h;
draw_process_text[i].bkcolor = bkcolor;
draw_process_text[i].flag = true;
return i;
}
}
}
[hr]
すみません書き忘れてました
エラーメッセージです
エラー 6 error LNK2001: 外部シンボル ""struct dp_ts_t * draw_process_text" (?draw_process_text@@3PAUdp_ts_t@@A)" は未解決です。 Plusfunction.obj
エラー 7 error LNK2001: 外部シンボル ""struct dp_ts_t * draw_process_text" (?draw_process_text@@3PAUdp_ts_t@@A)" は未解決です。 SAIS -Iris-.obj
エラー 8 error LNK2001: 外部シンボル ""int now_state" (?now_state@@3HA)" は未解決です。 InterfaceA.obj
エラー 9 fatal error LNK1120: 外部参照 2 が未解決です。 U:\SAIS -Iris-\Debug\SAIS -Iris-.exe 1