作者skitty (aki)
看板C_and_CPP
标题[问题] Windows form全域变数
时间Tue Jan 12 11:44:56 2016
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
c++2010 Windows form
问题(Question):
我想要宣告一个全域用的变数和阵列
上网查资料在.h档试了以下几种:
1. Form1 底下宣告 int i
2. Form1底下宣告 int A[10]
3. Form1底下宣告 array<int^>^ Arry= gcnew array<int^>(10)
4. namespace底下宣告
public class A{
public: static int a1;
static int b1[10];
};
但是在.cpp档main中都无法呼叫
ex 打Form1::i会说是不合法的
想请问是我宣告有误还是呼叫有误…
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 223.137.182.196
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1452570299.A.9DB.html
1F:推 kwpn: int i没宣告成static 01/12 21:06
2F:→ makubex49: 一般来说这类问题我会用extern来处理 02/22 21:51