definition of static data member '*::staticMetaObjectExtraData' of dllimport [问题点数:40分,结帖人vip2006_007]

Bbs1
本版专家分:0
结帖率 100%
Bbs2
本版专家分:191
Bbs2
本版专家分:191
Bbs1
本版专家分:0
Qt5::Q_OBJECT异常报错Client::staticMetaObject’未定义的引用,collect2: error: ld returned 1 exit status
1,错误 宏定义异常,导致自定义的槽函数无法使用。 具体原因不解释了,搜索一下一大堆。 2,解决方法 在CMakeLists中添加 SET(CMAKE_AUTOMOC ON) SET(CMAKE_AUTOUIC ON) SET(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) 这四句话含义:#自动调用moc,uic,rcc处理qt的扩展部分...
基于QWidget类的动态库在4.8.1隐式调用时出现staticMetaObject' of dllimport'd class的解决办法
具体提示如下: App\debug\moc_scopewidget.cpp:56: 错误:<em>definition</em> of <em>static</em> <em>data</em> <em>member</em> 'ScopeWidget::<em>static</em>MetaObjectExtraData' of <em>dllimport</em>'d class 同时还有一些警告: App\debug\moc_scopewidget.cpp:56: 警告:'ScopeWidg
definition of dllimport data not allowed error?
I am using VC6.0. I try to run a sample program when I met the above mentioned error. I don't know what's wrong. can anyone give me a hint?rncompiling results:rnrne:\research\program\testfeature\color_attrib.cxx(19) : warning C4273: 'is_ATTRIB_COL' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(19) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(35) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(39) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(43) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(47) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(50) : error C2653: 'ATTRIB_NYG' : is not a class or namespace namerne:\research\program\testfeature\color_attrib.cxx(60) : error C2614: 'ATTRIB_COL' : illegal <em>member</em> initialization: 'ATTRIB_NYG' is not a base or <em>member</em>rne:\research\program\testfeature\color_attrib.cxx(103) : error C2065: 'ATTRIB_NYG_TYPE' : undeclared identifierrnat_nyg.cxxrne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'ATTRIB_NYG_TYPE' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'is_ATTRIB_NYG' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : error C2491: 'ATTRIB_NYG_subclasses' : <em>definition</em> of <em>dllimport</em> <em>data</em> not allowedrne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'add_method' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'call_method' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'make_copy' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'identity' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'type_name' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'size' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'save' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'fix_pointers' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'copy_<em>data</em>' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'fixup_copy' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'lose' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'ATTRIB_NYG::~ATTRIB_NYG' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'debug_ent' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'save_common' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'restore_common' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'is_deepcopyable' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'copy_common' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'copy_scan' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'fix_common' : inconsistent dll linkage. dllexport assumed.rne:\research\program\testfeature\at_nyg.cxx(18) : warning C4273: 'ATTRIB_NYG::ATTRIB_NYG' : inconsistent dll linkage. dllexport assumed.rnError executing cl.exe.rnrntestfeature.exe - 14 error(s), 23 warning(s)
About static data member
我在类中声明一个STATIC DATA MEMBER,在MAIN()rn中改变并输出该MEMBER的值,别的什么都没干,却在编译的时候告诉我一个未决议的内部标识符!rnclass objrn<em>static</em> int a;rnrnmain()rnrnobj obj1;rnobj1::a=1;rncout<<
staticMetaObjectExtraData”: 不允许 dllimport 静态数据成员的定义
testManage.hrn#ifndef TEST_MANAGErn#define TEST_MANAGErnrn#ifdef MYLIBDLLrn#define MYLIBDLL_A _declspec(<em>dllimport</em>)rn#elsern#define MYLIBDLL_A _declspec(dllexport) rn#endifrnrn#endifrnrnrn//////////////////rntestdll1.hrn#ifndef TESTDLL1_Hrn#define TESTDLL1_Hrnrn#include rn#include "ui_testdll1.h"rn#include "testManage.h"rn#include rn#include rnusing namespace std;rnrnclass MYLIBDLL_A testDll1 : public QMainWindowrnrn Q_OBJECTrnrnpublic:rn testDll1(QWidget *parent = 0, Qt::WFlags flags = 0);rn ~testDll1();rnrn void printMe();rnprivate:rn Ui::testDll1Class ui;rn;rn#endifrnrn////////////////////////////////rntestdll.cpprn#include "testdll1.h"rnrntestDll1::testDll1(QWidget *parent, Qt::WFlags flags)rn : QMainWindow(parent, flags)rnrn ui.setupUi(this);rnrnrntestDll1::~testDll1()rnrnrnrnrnrnvoid testDll1::printMe()rnrn std::cout << "hello" << endl;rnrnrn生成的时候,提示错误:rn错误 5 error C2491: “testDll1::<em>static</em>MetaObjectExtraData”: 不允许 <em>dllimport</em> 静态数据成员 的定义 E:\Projects\testDll1\testDll1\GeneratedFiles\Debug\moc_testdll1.cpp 47rn错误 7 error C2491: “testDll1::<em>static</em>MetaObject”: 不允许 <em>dllimport</em> 静态数据成员 的定义 E:\Projects\testDll1\testDll1\GeneratedFiles\Debug\moc_testdll1.cpp 51rn我用的平台是vs2010. 好奇怪的问题啊。求同志们踊跃发言。哈哈哈
static data member 的初始化问题.
#include rnusing namespace std;rnstruct Arn<em>static</em> int i;rn;rnint f() return A::i+7;rnint A::i = f();rnrnint main()rnrn A a;rn cout << a.i;rn system("PAUSE");rnrnrnA::i的初始化要调用 f()而f() 要用到A::i但这程序的结果反应出在A::i未初始化前调用rnf()的时候用到的A::i总是0的.为什么呢?
在中,有关static class data member的问题.
在《深度探索C++对象模型》一书88页,侯捷先生加的译注说道: rn“甚至即使该class没有任何object实体,其<em>static</em> <em>data</em> <em>member</em>也已存在” rn小生有一点疑问: rn没有object实体的class是什么意思?比如我引入了一个头文件,里面定义了A,B,C,D,E五个class,而我的程序实体里面又只使用的A这一个class,那么B,C,D,E算不算是没有object实体的class?如果算是的话,那么这4个class的<em>static</em> <em>data</em> <em>member</em>岂不存在于程序的stack里面?(即使从来不会用到) rn小生的理解是,“没有object实体的class”是不是指的以下情况: rn//导入classA rnA a=new A(); rn...//对a进行处理 rndelete a; rnrn这时在程序中A已经没有object,这样的A才是侯捷先生所指的“没有object实体的class”? rnrn请各路高手指教!
Qt使用导出类报错:error C2491: “ZMapWidget::staticMetaObject”: 不允许 dllimport 静态数据成员 的定义
在使用一个继承自QObject带有Q_OBJECT宏的导出类时,编译报错:不允许 <em>dllimport</em> 静态数据成员 的定义。 原因是自动生成的moc文件带有静态函数,无法导出。 1、在Qt中的解决办法是不将导出宏定义成Q_DECL_IMPORT。 #if defined(ZMAP_LIBRARY_PRODUCTOR) # define ZMAP_API Q_DECL_EXPORT #els...
QObject多继承static_meta_object的编译问题
问题描述 继承一个类,再继承自QObject并添加Q_OBJECT的宏之后,编译不过。 class A{public: A(){}; ~A(){}; private: int m_aval; }; class DerivedObject : public A,public QObject { Q_OBJECT public: DerivedO...
请问c++标准中,到底是否可以直接在 class中 初始化static member data?中讲得不一致啊...有看过cp的老大讲解下嘛!
请问c++标准中,到底是否可以直接在 class中 初始化<em>static</em> <em>member</em> <em>data</em>?中讲得不一致啊...有看过cp的老大讲解下嘛! (c
错误:invalid use of non-static data member 'main_form::zhiliu_datainfo'
google翻译:使用无效的非静态数据成员的main_form:: zhiliu_<em>data</em>info;难不成只能使用静态的数据? 静态就静态了,这个又不是不可以改的,(以前把静态变量和常量进行了混淆,现在明白了,这就不是个问题了) 果断加上<em>static</em>: Q_INVOKABLE <em>static</em> u_char zhiliu_<em>data</em>info[30]; //直流 再编译一下: 错误:un
怎样给static data member赋值?
比如:rnclass Arnrn <em>static</em> int i;rn public:rn ...rn;rnrnclass Brnrn <em>static</em> int i;rn public:rn ...rn;rnrnint A::i=10;rnint B::i=5;rnrnvoid main()rnrn A a;rn B b;rnrn b=a; //怎样赋值?rn ...rnrn
很奇怪的题,什么叫做data member definition
[code=C/C++]rnrnclass Arn private: int a; // Onern public:rn A(int a=0): // tworn wheels(wheels) // threern int getA()rn return a;rn rn;rnrnA aaa; // fourrn[/code]rn问题是,上面的one, two, three, four 中,哪一个代表的是 <em>data</em> <em>member</em> <em>definition</em>
DllImport static 多线程的问题
因为要做串口编程需要调用系统APIrn [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]rn private <em>static</em> extern int WriteFile(IntPtr hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, ref OVERLAPPED lpOverlapped);// ref System.Threading.NativeOverlapped lpOverlapped);rnrn声明了一个静态方法,如果是多线程的情况怎么办?rn每个线程都会调用 WriteFile 会不会出问题?怎么才能解决
关于 static class member
谁能说说怎么初始化一个<em>static</em> class <em>member</em>?rn我按c++primer和the c++ programming language上讲的试了好几遍都不行,rn
static member的小问题
class Apublic:<em>static</em> int k;;rnint main()rnrn A::k =0;//在连接的时候通不过;rnrn但我如果直接用A a;就会出现没有初始化k
错误 2 error C2491:xx: 不允许 dllimport 静态数据成员 的定义
        今天在使用 vs 做一个 dll 库,由于要是用 单件模式,在 .h 文件中声明了一个 <em>static</em> 的指针,在对应的cpp文件中定义该变量。导出的时候出现了一个错误:                 错误 2error C2491: “SDK_functions::pinstance_”: 不允许 <em>dllimport</em> 静态数据成员 的定义          出现这个错误的原因...
VS2005编译DLL错误,error C2491: 'CMyClass::Function' : definition of dllimport function not allowed
在VS2005下写C++(MFC除外)程序的时候,我不喜欢向导生成的那几个附属文件“stdafx.h”和"stdafx.cpp"。因为如果你的代码放在另一个编译器上的时候就需要改很多东西。我现在都习惯使用了自己写的一个头文件"start.h",每次都手动引进来。 今天用C++制作DLL的时候也是一样,生成了一个项目名是MyTest的Empty project, 然后手动定义DLL的引入,(仅此是例子)#ifndef MYDLL # ifdef MYDLL_E
definition of dllimport static data member not allowed 另一个检查点
: : <em>definition</em> of <em>dllimport</em> <em>static</em> <em>data</em> <em>member</em> not allowed  可能是模块的cpp加入到了主工程中造成的,  这个编译时报错的, 而且单独编译可以, 而主工程编译时会报这个error。 所以不一定是因为 模块中未设置里面的预定义宏造成的 。 再次遇到一定要先检查下主工程fillview
跪求高手指点VC6.0切换VS2010遭遇问题:error C2491:definition of dllimport function not allowed
原本工程是VC6.0的,切换编译工程后,VS2010始终报错。 原始代码: 在.h文件中首先定义 #ifdef SNACCDLL_EXPORTS #define SNACCDLL_API __decl
static member function问题
<em>static</em> <em>member</em> function与non-<em>static</em> <em>member</em> function有什么区别?
Data语意学 继承与Data Member
单继承在没有多态的情况下比较简单,只是把基类堆叠到派生类上边,组成一个新的类。注意基类的alignment造成的调整边界产生的内存使用并不会消失。class A{ public: char a; }; class B: public A{ //B的大小是8 public: int c; };加上多态后需要在object中导入一个vptr,加入的vptr可以放在尾部(与C stru
请问,如果一个class的static data member是另一个class,那么,这个static data member的destructor什么时候被调用?
比如Effective C++条款10中的那个class Pool,什么时候才会调用它的destructor呢?
data member 指针的问题
深度探索c++对象模型rnclass Arnrnpublic:rn int m;rn int n;rn;rnrnint main()rnrn A a;rn printf("%d,%d",&A::m-1,&A::n);rnrnrn编译有错误:rnerror C2296: '-' : illegal, left operand has type 'int A::*'rnrn我用的是vc6.0, 用g++也是如此。rnrn但书上明明有这样的例子啊。p98.
3.4 “继承”与Data Member
一、基本Class模型在C++继承模型中,一个derived class object所表现出来的东西,是其自己的<em>member</em>s加上其base class(es) <em>member</em>s的总和。置于derived class <em>member</em>s和base class(es) <em>member</em>s的排列顺序,则未在C++ Standard中强制指定:理论上编译器可以自由安排之。在大部分编译器的上头,base class
求助,这个报错是为什么
-
error C2491 definition of dllimport static data member not allowed(不允许dllimport静态数据成员的定义)
在VC2008中,如果项目的输出类型是Lib库,且MFC使用方式为Use MFC in a Shared DLL时,如果该项目中的类定义时使用AFX_EXT_CLASS,且类中有静态成员,则会出现以上错误,及警告warning C4273:  inconsistent dll linkage。         解决办法:类定义时不要使用AFX_EXT_CLASS。
有关error C2491: 'CComboBoxSelEx::messageMap' : definition of dllimport static data member not allowed错误的问题,诚恳指教,万分
编译project时出现如下两个错误: 1、error C2491: 'CComboBoxSelEx::messageMap' : <em>definition</em> of <em>dllimport</em> <em>static</em> dat
definition of dllimport function not allowed 错误
今天出现了这个错误,在 属性--》C/C++--》Preprocessor    忘记添加响应的宏了。 
关于static data member的问题,请高手指点
我参考Essential C++第五章的内容,研究<em>static</em> <em>data</em> <em>member</em>和const function的问题,写了一段测试代码,可是怎么也编译不过去,请高手指点rnrn#include rn#include rnrnusing namespace std;rnrnclass A rnpublic:rn <em>static</em> vector vec;rn void fun( ) const ;rn;rnrnvoid A::fun() constrnrn vec.push_back(1);rnrnrnvoid main()rnrn A fib;rnrnrn------------------------------------------------rn编译报错:rnrnUndefined first referencedrn symbol in filernA::vec /var/tmp/cciKzBNr.ornld: fatal: Symbol referencing errors. No output written to tstrncollect2: ld returned 1 exit statusrnrn??????????????????????????????rn
dllimport,static,到底是谁的问题?
我的程序:rnpublic class Arnrn [<em>dllimport</em>("XXX.dll")]rn public extern <em>static</em> int initA()rnrnrnpublic class Brnrn int i;rn i=A.initA()rnrn执行完i=A.initA()之后,出现nullreferenceexception异常,XXX.dll是一个第三方开发库,宣称与编程语言无关,请大家指点一
怎样使用static member
我在自己写的类里用一点问题也没有,但是在一个用classwizard生成的类里,只能声明,不论是用<em>static</em> function还是一般的<em>member</em> function都不行亚
const static class member问题
<>P14,给了一个例子:rnclass GamePlayer rn <em>static</em> const int NUM_TURNS = 5;rn int scores[NUM_TURNS];rn //.......rn;rn并且说:“以上所见的只是NUM_TURNS的一个声明而非定义。你还必须在程序文件中定义<em>static</em> class memebers:rnconst int GamePlayer::NUM_TURNS;//class专属常量的定义应该放在class的实现文件中rn”rn****我的疑问****:rn1、好象不是“必须在程序文件中定义”把,我将.h文件中放class的声明,.cpp文件中没有放定义也是可以的。rn2、(不只是在类中)为什么<em>static</em>变量在声明的时候一定要加,在定义式就不需要加了(如果已经声明)?rnrn我是菜鸟,大虾请指点...
static member variable 的初始化及使用
各位大牛好,rnrn    我在学 <em>static</em> <em>member</em> variable 的时候,不了解当 <em>static</em> <em>member</em> variable 是 private的属性时,该怎麽去做初始化的动作,所以就打算用 <em>static</em> <em>member</em> function 去做初始化…但下面这段代码不知道为何一直报错…rnrn[code=c]#include rn#include rnclass carrn private:rn char color[10];rn <em>static</em> int car_count;rn public: rn // Constructorrn car(const char *a_color)rn car_count++;rn strcpy(color,a_color);rn rn ~car()car_count--;rn <em>static</em> void init_car_count() car_count=0; rn <em>static</em> int get_car_count() return car_count; rn rn;rnrnrnint main()rnrn car::init_car_count();rn car a("red");rn car b("blue");rn int num = car::get_car_count();rn printf("total cars:%d\n",num);rn return 0;rn[/code]rnrn错误讯息为:rn/tmp/ccSoSdJ3.o: In function `car::car(char const*)':rna.cpp:(.text._ZN3carC2EPKc[_ZN3carC5EPKc]+0x12): undefined reference to `car::car_count'rna.cpp:(.text._ZN3carC2EPKc[_ZN3carC5EPKc]+0x1b): undefined reference to `car::car_count'rn/tmp/ccSoSdJ3.o: In function `car::~car()':rna.cpp:(.text._ZN3carD2Ev[_ZN3carD5Ev]+0xa): undefined reference to `car::car_count'rna.cpp:(.text._ZN3carD2Ev[_ZN3carD5Ev]+0x13): undefined reference to `car::car_count'rn/tmp/ccSoSdJ3.o: In function `car::init_car_count()':rna.cpp:(.text._ZN3car14init_car_countEv[_ZN3car14init_car_countEv]+0x6): undefined reference to `car::car_count'rncollect2: error: ld returned 1 exit statusrnshanwu@shanwu-laptop:~/c_c++_practice$ vim a.cpp rnshanwu@shanwu-laptop:~/c_c++_practice$ g++ -o a a.cpprn/tmp/ccuH53qO.o: In function `car::car(char const*)':rna.cpp:(.text._ZN3carC2EPKc[_ZN3carC5EPKc]+0x12): undefined reference to `car::car_count'rna.cpp:(.text._ZN3carC2EPKc[_ZN3carC5EPKc]+0x1b): undefined reference to `car::car_count'rn/tmp/ccuH53qO.o: In function `car::~car()':rna.cpp:(.text._ZN3carD2Ev[_ZN3carD5Ev]+0xa): undefined reference to `car::car_count'rna.cpp:(.text._ZN3carD2Ev[_ZN3carD5Ev]+0x13): undefined reference to `car::car_count'rn/tmp/ccuH53qO.o: In function `car::init_car_count()':rna.cpp:(.text._ZN3car14init_car_countEv[_ZN3car14init_car_countEv]+0x6): undefined reference to `car::car_count'rn/tmp/ccuH53qO.o:a.cpp:(.text._ZN3car13get_car_countEv[_ZN3car13get_car_countEv]+0x6): more undefined references to `car::car_count' followrncollect2: error: ld returned 1 exit statusrn
static member variable的初始化问题
<em>static</em> variables are initialized at class load time. 这句话怎么理解?rnrn静态成员变量是不是和非静态成员变量一样,在构造器执行之前初始化的?rnrn请指教!
急求解决这个问题:illegal reference to data member 'CM_TestDlg::m_intNum' in a static member function
弄了好长时间一直出错,就是程序编译没有问题,但运行后就提示“遇到问题需要关闭”,但尝试着修改也不行,只好拿到这里来让各位老师给看下了,先谢了!rn我的程序是这样的:rnrnrn#define StartSimuThreadMSG WM_USER+110rnrnclass CM_TestDlg : public CDialogrnrn// Constructionrnpublic:rn //查询线程创建rn <em>static</em> UINT IntCheckThread(void *param);rn CWinThread *pCheckThread;rnrn //仿真线程创建rn <em>static</em> UINT SimulinkThread(void *param);rn CWinThread *pWorkSimulinkThread;rnrn void ShowInfo(CString str); //显示rnrn// Dialog Datarn //AFX_DATA(CM_TestDlg)rn enum IDD = IDD_M_TEST_DIALOG ;rn CListBox m_ListShow; rn...rn DWORD m_intNum; //m_intNum为编辑框控件关联的变量rn //AFX_DATArnrn...rnprotected:rn // Generated message map functionsrn //AFX_MSG(CM_TestDlg)rn...rnrn afx_msg void OnStartSimuThread(WPARAM wParam,LPARAM lParam); //消息定义rnrn //AFX_MSGrn DECLARE_MESSAGE_MAP()rn...rnrnrnBEGIN_MESSAGE_MAP(CM_TestDlg, CDialog)rn //AFX_MSG_MAP(CM_TestDlg)rn...rn ON_MESSAGE(StartSimuThreadMSG,OnStartSimuThread) //消息映射rnrn //AFX_MSG_MAPrnEND_MESSAGE_MAP()rnrnrnrnrnvoid CM_TestDlg::OnStart() rnrn...rn //-------创建事件查询线程-------//rn pCheckThread=AfxBeginThread(IntCheckThread,this,THREAD_PRIORITY_HIGHEST);rn...rnrnrnrn//------查询线程函数---------//rnUINT CM_TestDlg::IntCheckThread(void *param) rnrn CM_TestDlg *dlg=(CM_TestDlg *) param; rn dlg->GetParent(); rnrn if(bThreadflag)rn rn //---------开辟仿真线程--------//rn AfxGetMainWnd()->SendMessage(StartSimuThreadMSG,0,0);rn rn...rn return 0;rnrnrn//-------创建线程-----//rnvoid CM_TestDlg::OnStartSimuThread(WPARAM wParam,LPARAM lParam)rnrn //创建挂起线程SimulinkThreadrn pWorkSimulinkThread=AfxBeginThread(SimulinkThread,0,THREAD_PRIORITY_HIGHEST-rnrn1,0,CREATE_SUSPENDED,NULL);rn rn pWorkSimulinkThread->ResumeThread();rnrnrn//-------线程函数----//rnUINT CM_TestDlg::SimulinkThread(void *param) rnrn AfxMessageBox("仿真线程启动",MB_OK);rnrn CM_TestDlg *dlg=(CM_TestDlg *) param; rn dlg->GetParent(); //貌似有问题rnrn CString str;rnrn str.Format("%d",dlg->m_intNum++); rn dlg->ShowInfo(str);rnrn return 0;rnrnrn//--------显示--------//rnvoid CM_TestDlg::ShowInfo(CString str) rnrn m_ListShow.InsertString(m_ListShow.GetCount(),str); rnrn//str为被插入的内容指针rn m_ListShow.SetCurSel(m_ListShow.GetCount()-1); rn//m_ListShow是为ListBox控件关联的变量rn return;rnrnrn请问为什么程序总是运行后出错要求关闭呢?该怎么解决呢?rnrn非常感谢!rnrnrn
error C2597: illegal reference to data member 'CMltithrdView::Tflag' in a static member function
error C2597: illegal reference to <em>data</em> <em>member</em> 'CMltithrdView::Tflag' in a <em>static</em> <em>member</em> functionrnTflag 是我在CMltithrdView中声明的一个公有变量。在CMltithrdView::Func(...)中访问Tflag时编译报错。 Func(...)在CMltithrdView中声明为一<em>static</em> <em>member</em> function。 why ? help me!!!
一个添加data member的问题
有两个类CTextureDlg 和 CGrayShow, 我想在CTextureDlg 中添加一个为rnCGrayShow类的对象的<em>data</em> <em>member</em> m_showGray,rnrn我在CTextureDlg.h 中加入了 #include "GrayShow.h" 和rnClass CGrayShow;rn然后rnpublic:rnCGrayShow m_showGray;rnCompile 后得到这样的问题:rne:\rs\图像处理\test\myproject\texturedlg.h(20) : error C2079: 'm_grayShow' uses undefined class 'CGrayShow'rn请问如何解决
Date语意学 Data Member的存取
已知下面这段代码Point3d origin,*pt = &origin;存取<em>data</em> <em>member</em>有什么区别origin.x = 0.0; pt->x = 0.0;Static Data MembersStatic <em>data</em> <em>member</em>s被编译器提出于class之外,被视为一个global变量。 若X是一个Static <em>data</em> <em>member</em>s,则origin.x = 0.0; pt->x =
菜鸟提问:class template , static class member
编程时遇到一个问题,简单说情况如下:rnrn头文件:silly.hrnrn#ifndef silly_h_rn#define silly_h_rnrn#include < vector >rnusing std::vector ;rnrntemplate < typename T , int m > // class A 基于两个参数,一个是任意类型,一个是 int .rnclass Arnprotected:rn vector group ;rn <em>static</em> int limit ; // <em>static</em> class <em>member</em>rnrnpublic:rn int Limit() return A::limit ; rn A() ;rn;rnrnrn#endifrnrnrnrn相关的 .cc 文件rnrn#include "silly.h"rnrntemplate < typename T , int m > // 初始化静态成员rnint A ::limit = 0 ;rnrntemplate < typename T , int m > // 给静态成员赋值rnA::A() rnrn limit = m ;rnrnrnrnrn主程序:rnrnint main ()rnrnrn A a1 ;rn A a2 ;rn cout << a1.Limit() << endl; // 希望输出结果是 5 和 7rn cout << a2.Limit() << endl;rnrn return 0;rnrnrn可以编译 , 但是不能运行,fatal error LNK1120: 1 unresolved externals。 向大家请教。rn我的想法就是,程序运行时有两个 limit, 一个属于 A 这个类, 还有一个属于 A 这个类。rnrnrn
ETG.1000.3: Data Link Layer service definition
ETG.1000.3: Data Link Layer service <em>definition</em>,EtherCAT协议第三部分:数据链路层服务定义,内含中英文介绍
继承时static与non static member的访问规则提问
我写了一段代码:rn[code=C/C++]class Arnrnprotected:rn <em>static</em> int i;rn;rnclass B:public Arnrnpublic:rn void f(B &b, A & a)rn rn i=10;rn this->i=10;rn b.i=10;rn B::i=10;rn a.i=10;rn A::i=10;rn rn;[/code]rn这段代码编译通过了,我的问题是:rnc++的继承访问规定:在derived class内部只能通过derived class的object,指向derived class的pointer或reference来访问protected <em>member</em>,而不能用指向base class的reference或pointer来访问protected <em>member</em>,在上面代码中,i是A的protected <em>member</em>,为什么B中的a.i=10和A::i=10可以通过编译?rn为了对比我改了改代码,将i变成普通变量:rn[code=C/C++]class Arnrnprotected:rn int i;rn;rnclass B:public Arnrnpublic:rn void f(B &b, A & a)rn rn i=10;rn this->i=10;rn b.i=10;rn B::i=10;rn a.i=10;rn A::i=10;rn rn;[/code]rn这时再编译a.i=10;这一行就报错了,所以请问,是不是对于<em>static</em>和non <em>static</em> <em>member</em>,继承访问规则不同呢?如果如上面所示真的是不同的话,原因又是为什么呢?请各位高手解答
c++的错误,请static member function 有错
public:rn CPoint m_pt;rnrnvoid CDrawText::SetText(CPoint pt, LPSTR str)rnrn m_pt=pt;rn m_str=str;rnrnrnerror C2597: illegal reference to <em>data</em> <em>member</em> 'CDrawText::m_pt' in a <em>static</em> <em>member</em> function
为啥Cuda C++不允许static member
如果没有<em>static</em> <em>member</em>,我怎么在device上做单例类?
请问static和 non-static member function的区别
请问<em>static</em>和 non-<em>static</em> <em>member</em> function的区别
关于template中static member初始化的问题
[code=C/C++]//测试在class template中有<em>static</em> <em>data</em> <em>member</em>srn#includernusing namespace std;rnrntemplate class testClassrnpublic:rn <em>static</em> int _<em>data</em>;rn;rnrnint testClass::_<em>data</em> =1; rnint testClass::_<em>data</em> =2; //这两句将模板实例化禀赋初值于_<em>data</em>有错误rnint main()rn cout< obji1,obji2; rn testClass objc1,objc2;rn rn cout<
为什么static member function不能是const的?
我不知道为什么,为什么不允许它是const的呢?如果可以是const不是可以用来禁止修改<em>static</em> 数据成员么?rn
static member function 提供了什么意想不到的好处?
rn “<em>static</em> <em>member</em> function 提供了一个意想不到的好处:成为一个callback函数,使我们得以将c++和 c-base X Window 系统结合。它们也可以成功地应用于线程(threads)函数身上。”rnrn --------------摘自inside C++ model(中文)152页顶
member = member = new Member(UserRole.Member);
[code=csharp]rn Member <em>member</em>;rn <em>member</em> = <em>member</em> = new Member(UserRole.Member);rn[/code]rn<em>member</em> = <em>member</em> = new Member(UserRole.Member)rn这句是什么意思呀?
请问member function definition looks like a ctor 是什么意思
请问<em>member</em> function <em>definition</em> looks like a ctor 是什么意思
DllImport
[DllImport("user32.dll")]rn public <em>static</em> extern int SendMessage(rn int hwnd,rn int wMsg,rn int wParam,rn int lParamrn );rnrn提示:错误 1 找不到类型或命名空间名称“DllImport”(是否缺少 using 指令或程序集引用?) rn不知道怎么用API呀!!
C++对象模型——Data Member的绑定(第三章)
3.1    Data Member的绑定 (The Binding of a Data Member)     考虑下面这段代码: // 某个foo.h头文件,从某处含入 extern float x; // 程序员的Point3d.h文件 class Point3d { public: Point3d(float, float, float); // 问题:被传回和被设定的
《深度探索C++对象模型》:Data member的布局
《深度探索C++对象模型》:Data <em>member</em>的布局
抽象类中的data member如何处理?
抽象类中的<em>data</em> <em>member</em>如何处理?rnrn 我发现,我的具体类要访问一个数据成员rn 那么,我如何处理?rn 1) priavtern 另外添加一个protected型的函数rn 2) 直接使用protected的数据成员rnrnrn 大家觉得哪种方式好?rn
深度探索C++对象模型———Data Member的布局
3.2 Data Member的布局(成员变量的布局)C++类对象中成员变量是以什么样的空间内存而布局的呢?对于下面一组<em>data</em> <em>member</em>s(成员变量):class Point3d { public: // ... private: float x; <em>static</em> List *freeList; float y; <em>static</em> con
关于取一个nonstatic data member的地址
正在看《深入探索c++模型》,定义了一个类Point3d,其中y为它的一个私有成员变量,为什么printf("&Point3d::y=%p\n",&Point3d::y);会出现rnE:\vcsl\新建文件夹\ordertest.cpp(30) : error C2248: 'y' : cannot access private <em>member</em> declared in class 'Point3d'rn E:\vcsl\新建文件夹\ordertest.cpp(10) : see declaration of 'y'rn这段编译错误呢?
DLLimport
在c++builder中生成一个DLLrnextern "C" __declspec(dllexport) void __stdcall Invoke_WinSockInfoConnect(HWND,AnsiString IPAddress, String *ReturnStr);rnextern "C" __declspec(dllexport) void __stdcall Invoke_GetWinSockText(String *s);rnrn在C#中调用rn [DllImport("InfoDispatchDll.dll",CharSet=CharSet.Auto)]rn public <em>static</em> extern void Invoke_WinSockInfoConnect(IntPtr Handle,string IPAddress, string ReturnStr);rn public <em>static</em> extern void Invoke_GetWinSockText(string s);rn启动调试时出现Invoke_GetWinSockText没有实现,没有RVArn大家看看怎么办啊
C++对象模型——Data Member的存取(第三章)
3.3    Data Member的存取     已知下面这段代码: Point3d origin; origin.x = 0.0;     x的存取成本是什么?     答案视x和Point3d如何声明而定,x可能是个 <em>static</em> <em>member</em>,也可能是个non<em>static</em> <em>member</em>.Point3d可能是个独立(非派生)的 class,也可能从另一个单一的base class
C++对象模型——"继承"与Data Member(第三章)
3.4 "继承"与Data Member  在C++继承模型中,一个derived class object所表现出来的东西,是其自己的<em>member</em>s加上其base class <em>member</em>s的总和.至于derived class <em>member</em>s和base class <em>member</em>s的排列次序并未在C++ Standard中强制指定:理论上编译器可以自由安排.在大部分编译器上,base clas
深度探索C++对象模型———Data Member的绑定
3.1 Data Member的绑定(成员变量的绑定)考虑这样一段代码:// 某个foo.h头文件,从某处含入 extern float x; // 程序员的Point3d.h文件 class Point3d { public: Point3d(float, float, float); // 问题:被传回和被设定的x是哪一个x? float X() const { retu
举例分析static data initalization
以下是源码:rnrnclass Bowl rn Bowl(int marker) rn System.out.println("Bowl(" + marker + ")");rn rn void f(int marker) rn System.out.println("f(" + marker + ")");rn rnrnrnclass Table rn <em>static</em> Bowl b1 = new Bowl(1);rn Table() rn System.out.println("Table()");rn b2.f(1);rn rn void f2(int marker) rn System.out.println("f2(" + marker + ")");rn rn <em>static</em> Bowl b2 = new Bowl(2);rnrnrnclass Cupboard rn Bowl b3 = new Bowl(3);rn <em>static</em> Bowl b4 = new Bowl(4);rn Cupboard() rn System.out.println("Cupboard()");rn b4.f(2);rn rn void f3(int marker) rn System.out.println("f3(" + marker + ")");rn rn <em>static</em> Bowl b5 = new Bowl(5);rnrnrnpublic class StaticInitialization rn public <em>static</em> void main(String[] args) rn System.out.println(rn "Creating new Cupboard() in main");rn new Cupboard();rn System.out.println(rn "Creating new Cupboard() in main");rn new Cupboard();rn t2.f2(1);rn t3.f3(1);rn rn <em>static</em> Table t2 = new Table();rn <em>static</em> Cupboard t3 = new Cupboard();rn ///:~rnrn谁能告诉我编译器的执行顺序是怎么样的?
为什么要转为一个static函数(static函数是不是指static member function)?
inside c++ model (中文)184页rnrn “如果函数因其复杂度,或因其建构问题,被判为不可成为inline ,它会被转为一个<em>static</em>函数”rn为什么要转为一个<em>static</em>函数(<em>static</em>函数是不是指<em>static</em> <em>member</em> function)?
no member 和no member function declared in class
A.h文件rn[code=c]rn#include rnclass Arnrnpublic:rn void saya();rn A();rn;rn[/code]rnrnA.cpp文件rnrn[code=c]rn#include "A.h"rn rnA::A()rnrn std::cout<<<
Member const 和Member 有什么区别?
《c++ programming lanauage》是这样写的:rnrn10.4.6.2Member ConstantsrnrnIt is also possible to initialize a <em>static</em> integral constant <em>member</em> by adding a constant-expression initializer to its <em>member</em> declaration. For example:rnrnclass :Curious rn <em>static</em> const int c1 =7; //ok ,but re<em>member</em> <em>definition</em> rn <em>static</em> int c2 =11; // error : not const rn const int c3 =13; // error: not <em>static</em>rn <em>static</em> const int c4 = f(17); // error: in-class initializer not constantrn <em>static</em> const float c5 =7.0; // error: in-class not integralrn //....rn;rnrnIf(and only if) you use an initalized <em>member</em> in a way that requires it to be stored as an object in memory, the <em>member</em> must be (uniquely) defined somewhere. The initializer may not be repeated:rn const int Curious::c1; // neccessory, but don't repeat initializer herern const int* p= &Curious::c1; //ok Curious::c1 has been definedrnrn那位高手能帮我解释一下上面的意思嘛?谢谢。rn其中,<em>static</em> 和const 为什么一定要连用。
CRM Definition
CRM is a focused approach to customer-related processes.。。。
definition问题?
对于一个自module中定义的类型,在某一窗体中使用是,点鼠标右键,使用<em>definition</em>,可以定位到类型定义处。以前是可以的,不知道为什么?现在不行了,请求解决方法。
在线等:How do you call a regular member function from a static member function?
如题。
DllImport讲解
介绍基本的用发,适用初级开发人员,想了解的同行们。
DllImport传参
引用c++的一个dll,有一函数原型是getJumbIcon(CONST TCHAR *filePath),c#里参数类型应该怎么定义,传的是字符串
dllimport问题
我有一个旧式dll文件中有一个函数int GetData(byte * pBuffer)rnrn如何用<em>dllimport</em>它,使得它可以被C#程序调用?rnrn我知道函数int GetValue(byte * pValue);rn可以这样用:rn[DllImport("yourDllFile.dll", EntryPoint="GetValue", SetLastError=true,rn CharSet=CharSet.Unicode, ExactSpelling=true,rn CallingConvention=CallingConvention.StdCall)]rnprivate <em>static</em> extern int GetValue(ref byte pValue);rnrn但是如果参数是用指针来获取一个数组怎么办?rnint GetData(byte * pBuffer)rnpBuffer是数组的首地址,也就是说GetData会写pBuffer[0],pBuffer[1]....pBuffer[100];
关于DllImport
使用rn[DllImport("my.dll")]rnpublic <em>static</em> extern double fun1();rn调用外部dllrn1。这个dll可以是C#写的类库文件名?rn2。为什么我调用时(c#的dll)总是找不到入口?rn3。什么叫托管/非托管rn
DllImport("User32.dll")
大侠们!调用这个函数的作用是?该怎么调用?rn.NET 里面经常调用的外部系统函数还有哪些?举例说明吧
DllImport的问题
RTAGENT_API long RTOpen(char *servername);rnRTAGENT_API long RTClose();rnRTAGENT_API long RTGetScadaYcNum();rnrnVC的方法,我在C#这边rn [DllImport("RTAgent.dll", SetLastError=true)]rn <em>static</em> extern int RTClose();rn rn [DllImport("RTAgent.dll", SetLastError=true)]rn <em>static</em> extern int RTGetScadaYcNum();rnrn [DllImport("RTAgent.dll", SetLastError=true)]rn <em>static</em> extern int RTGetScadaYcNum(char );rnrnchar *servername这个怎么来表示啊?rnchar 还是 string ??rnrn还有,是不是这样申明后就可以直接调用了?rn动态连接文件是VC的一个方法...rnrn
MySQL(二)—— DDL:数据定义语言 Data Definition Language
一、DQL:数据查询语言 Data Query Language 1、单张表的查询 (1)基本查询 select关键字 select 字段(*) from 表名 as关键字:别名 ,将这个字段用别名显示,as关键字可以省略。 select 字段(*) as 别名 from 表名 select 字段(*) 别名 from 表名 (2)条件查询 where关键字 whe...
数据库之数据库定义语义(DDL:data definition language)
关键字:CREATE ,DROP,USE,SHOW,ALTER,ADDCREATE:创建数据库,创建tableDROP:删除数据库,删除表格,删除列ADD:添加列USE:连接数据库SHOW:查看表格和数据库ALTER:复制数据表格结构和数据,修改表名(rename)...
数据库(六)-Data Definition Language:数据定义语言(2)
数据定义语言 在上一篇文章中已经介绍了操作数据库的语句包括数据库的创建、删除、以及更改数据库的数据集 一、创建表 CREATE TABLE 表名( 列名 列类型, 列名 列类型 ); /*注意“表名”后是&quot;()&quot;,而不是&quot;{}&quot;;*/ /*每定义一列,需要与下一行用&quot;,&quot;隔开,最后一行不需要加&quot;,&quot;;*/ 例如:我们要创建一个存储学生信息的表,表中有三列,分别为学生ID...
请问VC内dll与function pointer和static member的问题
我自写的dll内有宣告以下的function pointerrntypedef void (_stdcall * Event_OnStatus) (int, char*);rn在VC内使用它时rn宣告rntypedef void (* TEvent_OnStatus) (int, char*);rnpublic delegate void Event_OnStatus (int, char*);rnFunctionrn回传Func定义rn<em>static</em> void OnStatus (int status, char* msg)rn rn建构rnEvent_OnStatus^ callbackStatus = gcnew Event_OnStatus(&MyClass::Form1::OnStatus);rnSystem::IntPtr ptr1 = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(callbackStatus);rnTEvent_OnStatus pbackStatus = <em>static</em>_cast(ptr1.ToPointer());rnrn不过这样当我在OnStatus内要呼叫其他非<em>static</em> function时rn会出现” illegal call of non-<em>static</em> <em>member</em> functionrn”的错误rn如果不把OnStatus设为<em>static</em>则会出现rnerror C3352: 'void MyClass::Form1::OnStatus(int,char *)' : the specified function does not match the delegate type 'void (int,char *)'rn请问该怎么写才能正确使用呀rn
什么情况下会需要取 static member 的地址?
下面一段代码讲述取 <em>static</em> <em>member</em> 的地址的情况。不是很明白究竟在什么情况下才会需要取 <em>static</em> <em>member</em> 的地址?rnrn[code=C/C++]rnclass AE rn // ...rn public:rn <em>static</em> const int c6 = 7;rn <em>static</em> const int c7 = 31;rn ;rnrn const int AE::c7; // <em>definition</em>rnrn int f()rn rn const int* p1 = &AE::c6; // error: c6 not an lvaluern const int* p2 = &AE::c7; // okrn // ...rn rn[/code]
一个《C++ Primer》中static const member 的问题……
《C++ Primer》3rd edition P527中:(注释内容为书中原话)rnrn#include rnusing namespace std;rnrnrnclass Account rnpublic:rn Account(int x,char p[]):nameSize(x),name(p)rn <em>static</em> void raiseInterest( double incr );rn <em>static</em> double interest() return _interestRate; rnprivate:rn <em>static</em> double _interestRate;rn /*在类体内初始化一个const 静态数据成员时该成员必须仍然要被定义在类定义之外rn但是因为这个静态数据成员的初始值是在类体中指定的所以在类定义之外的定义不能指rn定初始值*/rn /*因为name 是一个数组不是有序类型所以它不能在类体内被初始化任何试图这rn么做的行为都会导致编译时刻错误*/rn <em>static</em> const int nameSize= 16; // ok: 有序类型rn <em>static</em> const char name[nameSize] ="Savings Account"; // 错误rn;rnrn//const int Account::nameSize=16;rnrn//const char Account::name[nameSize] = "Savings Account";rninline void Account::raiseInterest( double incr )rnrn_interestRate += incr;rnrnrnbool limitTest( double limit )rnrn// 还没有定义 Account 类对象rn// ok: 调用 <em>static</em> 成员函数rn return limit 0 )rn cout << ac1.owner()rn << " is richer than "rn << ac2.owner() << "\n";rn rn elsern cout << ac1.owner()rn << " is poorer than "rn << ac2.owner() << "\n";rn return 0;rnrnrn但是我在VC6.0+sp6中,rn<em>static</em> const int nameSize= 16; // ok: 有序类型rn总是编译通不过,请高手们帮忙解决一下哈!rn多谢!
how to define a static member in a template class
rnhi,下面是我在国外的论坛上面发的帖子,想到csdn上面也有很多高手,所以再发到此处寻求帮助rnrni have trouble to define a <em>static</em> <em>member</em> in a template, and i search from google, but didn't find any similar case, my case is a little complex, i paste the code below.rnrncode in xxx.hrnrn[code=C/C++]template class FreeListManagerrnrn public:rn FreeListManager(int s=0);rn ~FreeListManager();rn T* acquire();rn void release(T*);rnrn protected:rn <em>static</em> list freeList;rn <em>static</em> list usedList;rn // We have size parameters separated from list, sincern // size() function of list container is inefficient.rnrn;rn[/code]rncode in xxx.cpprnrn[code=C/C++]include "xxx.h"rnrntemplate listrn FreeListMaager::freeList;rntemplate listrn FreeListManager::usedList;rnrn//there is no T defined[/code]rnrnfor the xxx.cpp file, actually, it is confused me a lot, and it seem to be not what i want, what is the type of the entry in freeList like after above <em>definition</em>? i got coredump when use the freeList.pushback. and i ever tried to define the two list <em>static</em> <em>member</em> likernrnrn[code=C/C++]template listrn FreeListManager::freeList;rntemplate listrn FreeListManager::usedList;rnrntemplate listrn FreeListManager::freeList;rntemplate listrn FreeListManager::usedList;[/code]rnrni got re<em>definition</em> for freeList and usedList error.rni was told FreeListManager and FreeListManager are totally two different class, why does the re<em>definition</em> error come out?rnrni also tryrnrnrn[code=C/C++]list FreeListManager::freeList;rnlist FreeListManager::usedList;rnrnlist FreeListManager::freeList;rnlist FreeListManager::usedList;[/code]rnrni got too few template-parameter-lists error, the code can be compiled on gcc earlier version,rnrnhe code was download from opendiameter project, it can be compiled by very old version gcc complier.rnrnbut i found it cannot compliled by gcc-4.1.2rnrnAs i know, FreeListManager is a only template, and FreeListManager is actual class, and FreeListManager is another one, i want to define two <em>static</em> list <em>member</em> for both class,FreeListManager::freeList, FreeListManager::freeList, so the two <em>static</em> <em>member</em> should be not one instance, but two. Just like what i testedrnrn[code=C/C++]rntemplate class FreeListManagerrnrn public:rn <em>static</em> int counter;rn;rnrntemplate int FreeListManager::counter=0;rn//the following <em>definition</em> will report re<em>definition</em> error, eitherrn//template int FreeListManager::counter=0;rn//template int FreeListManager::counter=0;rn//i thought the complier only can initial the two <em>static</em> <em>member</em> once, and you can set other value later.rnrnFreeListManager::counter=2rnFreeListManager::counter=3rnrnmain()rnrn printf("FreeListManager::counter=%d\n",FreeListManager::counter);rn printf("FreeListManager::counter=%d\n",FreeListManager::counter);rnrn[/code]rn##########################rnthe result isrnFreeListManager::counter=2rnFreeListManager::counter=3rnrnso it seem there are two <em>static</em> variable FreeListManager and FreeListManagerrnrncan someone help me, really appreciate your help.
为什么在C++Buider的类中使用static member,link时出错?
为什么在C++Buider的类中使用<em>static</em> <em>member</em>,link时出错。rn如:rnrn.Hrn======================rnclass TTestrnrn <em>static</em> int iNum;rn public:rn __fastcall TTest();rnrnrnrn.CPPrn===========================rn__fastcall TTest::TTest()rnrn iNum++;rnrn
关于DLLimport
函数原型在下。 rnrnSTDMETHODIMP CFullTunnelServiceControl::FullTunnelServiceControl( rnBSTR * control_type, rnBSTR * username, rnBSTR * password, rnBSTR * sourcecode, rnBSTR * destcode, rnBSTR * ip, rnBSTR * port, rnBSTR * content, rnBSTR * sendtype, rnVARIANT *pvRE rn) rnrnrn这个是函数运行,调试后一切正常,在VB6.0中调用运行正常 rn我在c#中这样写 rnrn[DllImport("SendControl.dll",CharSet =CharSet.None )] rnpublic <em>static</em> extern Object FullTunnelServiceControl( ref string control_type, ref string name, ref string pwd, ref string sc, ref string dc, ref string ip, ref string port,ref string content,ref string sendtype); rnrn报错 pInvoke 限制,无法返回变量。 rn我估计就是定义这个地方写的不对,请教诸位那个能帮我纠正下 rnrnrnfunction FullTunnelControl(control_type,name,pwd,sc,dc,ip,port,content,sendtype) rn var CommandRtn; rntry rn rnrn//for(var i=0;i ); rn rnreturn; rn rnrnrn rnrnrn rnrn rn rnrn调试的时候,他给的例子是在网页中,直接用 var CommandRtn; 接受返回值,可以调试成功。 rn我引用的时候该如何定义呢
DllImport的使用
有一DLL,代码如下:rnnamespace DLLTestrnrn public class Invokerrn rn public bool Invoke(int k)rn rn if (k < 1)rn return true;rn elsern return false;rn rn rnrnrn我想外部调用这个DLL文件,这个文件没有给REGSVR32注册,并且我不想通过DLL引用,而通过DllImport,不知道如何实现。rn这个DLL文件是其他EXE使用,随EXE文件夹转移,可能非固定,我想在新程序外部设定这个DLL的路径,然后通过DllImport调用,谁能解答一下?
Universal Serial Bus Device Class Definition for Audio Data Formats
Universal Serial Bus Device Class Definition for Audio Data Formats. The intention of this document is to describe in detail all the Audio Data Formats that are supported by the Audio Device Class. This document is considered an integral part of the Audio Device Class Specification, although subsequent revisions of this document are independent of the revision evolution of the main USB Audio Specification. This is to easily accommodate the addition of new Audio Data Formats without impeding the core USB Audio Specification.
1、DDL(data definition Lanaguage)数据库模式定义语言
一定义 二相关语句 三例子 四字段属性之一数据类型 五字段属性之二约束一、定义: DDL is Data Definition Language statements. Some examples:数据定义语言,用于定义和管理 SQL 数据库中的所有对象的语言 二、相关语句 CREATE - to create objects in the <em>data</em>base 创建 ALTER - alters
dllimport 构造函数
一个类的构造函数在Dll项目中导出后rn在托管项目中怎么用DllImport来声明使用这个构造函数rnrn比如test.dll项目中有如下类rnclass xyzrnrnpublic:rn __declspec(dllexport) xyz(double v1, double v2, double v3);rnrnprivate:rn double x;rn double y;rn double z;rn;rnrn在托管C++项目中有rnvalue class XYZrnrnpublic:rn double x;rn double y;rn double z;rnrnrnref class testrnrnpublic:rn [DllImport("test.dll", EntryPoint="×××")] rn <em>static</em> ##函数声明###;rnrnrn上面的“##函数声明###”这一段怎么写,参数和返回值分别是什么rn这个函数的目的是使用非托管类xyz的构造函数,来初始化托管类XYZ;rn
_declspec(dllimport)
我在一个工程里工程里这样申明函数指针调用dll里的函数:rntypedef BOOL _declspec(<em>dllimport</em>) (*THEFUNCTION)()rnok,另一个里工程里同样的申明:rntypedef BOOL _declspec(<em>dllimport</em>) (*THEFUNCTION)()rnrn报错:rnCompiler Error C2071rn'identifier' : illegal storage classrnThe named identifier was declared with an illegal storage class.rnrn这个是为什么啊?我把_declspec(<em>dllimport</em>)去掉,报错的那个也不报错了
DLLImport是什么?
有些C#程序里要用到DLLImport,这是不是一个函数库?rnrn它和.NET类库的区别是什么?.NET类库功能这么强大,为什么还要用DLLImport?rn
dllimport的问题!
我用下面方法rn[DllImport("Project1.dll")]rnunsafe private <em>static</em> extern void CustomerForm();rn将dll的CustomerForm方法引进webservice,但是调用CustomerForm时出现rn“HTTP 500 - 内部服务器错误 ”,无法显示该页。我的Project1.dll是个普通的dll,CustomerForm里创建了一个窗体。请高手指教,为什么会这样?
__declspec(dllimport)
有朋友有关于 __declspec(<em>dllimport</em>),__declspec(dllexport)程序的列子让在下看看。rn我做了总有点问题???/rn或者发phoenix_fei@sina.com rnrnthanks
static int data[4][3]=1,3,5,7,9,2,4,6,8,10,11,12;
<em>static</em> int <em>data</em>[4][3]=1,3,5,7,9,2,4,6,8,10,11,12;rn int (*p)[3];rn p=<em>data</em>;rn cout<<
The report definition is not valid. Details: Data at the root level is invalid
网站原来报表有服务器端报表和客户端的,之前可以运行,后来全部改成客户端报表,在本地调试运行没有问题,但是上传到服务器报错误,之前的客户端报表也报相同的错,网站重新发布了好几次 还是一样 求解。。rnServer Error in '/SG' Application.rn--------------------------------------------------------------------------------rnrnThe report <em>definition</em> is not valid. Details: Data at the root level is invalid. Line 1, position 1. rnDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. rnrnException Details: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: The report <em>definition</em> is not valid. Details: Data at the root level is invalid. Line 1, position 1.rnrnSource Error: rnrnAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. rnrnStack Trace: rnrnrn[ReportProcessingException: The report <em>definition</em> is not valid. Details: Data at the root level is invalid. Line 1, position 1.]rn Microsoft.ReportingServices.ReportProcessing.ReportPublishing.Phase1(CatalogItemContext reportContext, Byte[] <em>definition</em>, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, String& description, String& language, DataSourceInfoCollection& <em>data</em>Sources, UserLocationFlags& userReferenceLocation, Boolean& hasExternalImages, Boolean& hasHyperlinks) +804rn Microsoft.ReportingServices.ReportProcessing.ReportPublishing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] <em>definition</em>, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& <em>data</em>Sources, UserLocationFlags& userReferenceLocation, ArrayList& <em>data</em>SetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks) +99rn Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileReport(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& <em>data</em>Sources, UserLocationFlags& userReferenceLocation, ArrayList& <em>data</em>SetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks) +80rn Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions) +328rn Microsoft.Reporting.ReportCompiler.CompileReport(CatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ReportSnapshotBase& snapshot) +166rnrn[DefinitionInvalidException: The <em>definition</em> of the report 'Main Report' is invalid.]rn Microsoft.Reporting.ReportCompiler.CompileReport(CatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ReportSnapshotBase& snapshot) +228rn Microsoft.Reporting.StoredReport.CompileReport() +72rn Microsoft.Reporting.StoredReport.get_Snapshot() +32rn Microsoft.Reporting.StandalonePreviewStore.GetCompiledReport(CatalogItemContext context, Boolean rebuild, ReportSnapshotBase& snapshot) +352rn Microsoft.Reporting.LocalService.CompileReport(CatalogItemContext itemContext, Boolean rebuild) +30rn Microsoft.Reporting.WebForms.LocalReport.CompileReport() +90rnrn[LocalProcessingException: An error occurred during local report processing.]rn Microsoft.Reporting.WebForms.LocalReport.CompileReport() +125rn Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable`1 parameters) +53rn KeyCustomerbyCategory_2.btnInquiry_Click(Object sender, EventArgs e) +1144rn System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111rn System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110rn System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10rn System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13rn System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565rnrn rnrnrn--------------------------------------------------------------------------------rnVersion Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3053
MFC Socket编程下载
MFC 网络编程 Socket 服务端+客户端 相关下载链接:[url=//download.csdn.net/download/jiayangok/2817715?utm_source=bbsseo]//download.csdn.net/download/jiayangok/2817715?utm_source=bbsseo[/url]
hibernate学习笔记下载
hibernate学习笔记 简单易学 容易上手 相关下载链接:[url=//download.csdn.net/download/hzhnature/4483079?utm_source=bbsseo]//download.csdn.net/download/hzhnature/4483079?utm_source=bbsseo[/url]
Extjs4 主题包下载
网上很多主题包,但是Extjs4的没有多少,我好不容易找了一个深蓝色的,用着有的问题,就自己用sass重新生成.css文件,现在好用了。自己又加了绿色,深灰色,橘红色,红色,各种粉色和各种紫色,自己搭配的,可能颜色搭配的不是很好看,希望不要打击我。我Extjs用的4.1.1版本的,这些主题用都没有问题,不知道其他版本有没有问题,没有测试。 相关下载链接:[url=//download.csdn.net/download/xumeijuan45/4682731?utm_source=bbsseo]//download.csdn.net/download/xumeijuan45/4682731?utm_source=bbsseo[/url]
我们是很有底线的