|
안녕하세요.
빌더 2009에서 GlobalDefine.h // GlobalDefine.cpp를 만들어
전역 변수(여러군데서 많이 사용되서 만들어놓았습니다)를 저장했습니다.
내용은
헤더 :
//---------------------------------------------------------------------------
#ifndef GlobalDefineH
#define GlobalDefineH
//---------------------------------------------------------------------------
#endif
extern String AppPath;
extern String AppName;
cpp :
//---------------------------------------------------------------------------
#pragma hdrstop
#include <vcl.h>
#include "GlobalDefine.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
String AppPath = ExtractFilePath(Application->ExeName);
String AppName = Application->ExeName;
그런데 여기서 vcl.h가 필요 하더군요.
그런데 이상한게 헤더에다가 변수를 선언해서 정의까지 넣어놓으면 vcl.h가 없이 컴파일이 되더군요
헤더 :
extern String AppPath = ExtractFilePath(Application->ExeName);
extern String AppName = Application->ExeName;
이렇게 해도 잘 돌아가더군요... vcl.h 헤더 없이요...
뭔가 다른점이 있는지 알고 싶습니다.
또 프로그램의 여러 부분에서 자주 쓰이는 변수들을 어떻게 사용하는게 좋나요?
|