error C2146: syntax error : missing ';' before identifier 'm_cControlPos'
error C2501: 'CControlPos' : missing storage-class or type specifiers
error C2501: 'm_cControlPos' : missing storage-class or type specifiers加入一个头文件 #include "ControlPos.h"
在自己的类下加入:CControlPos m_cControlPos;后出现上面三处错误,
本人新手,不知如何解决,请高手帮忙
error C2501: 'CControlPos' : missing storage-class or type specifiers
error C2501: 'm_cControlPos' : missing storage-class or type specifiers加入一个头文件 #include "ControlPos.h"
在自己的类下加入:CControlPos m_cControlPos;后出现上面三处错误,
本人新手,不知如何解决,请高手帮忙
如果是一个Dll的话 要将.h对应的.lib文件加入工程
这个错误不是找不到cpp的问题,是找不到这个类定义的问题,所以看看你的ControlPos.h里面是怎么定义的
// ControlPos.h
//
// CControlPos
// Position controls on a form's resize
//
// Copyright (c) 2000 Paul Wendt
//
// VERSION# DATE NAME DESCRIPTION OF CHANGE
// -------- ---------- ---- ---------------------
// 1.01 07/11/2000 PRW Original creation.
//
#ifndef CONTROLPOS_H_
#define CONTROLPOS_H_//----------------------------------------------
// these #define's specify HOW the control
// will move. they can be combined with the
// bitwise or operator
//
#define CP_MOVE_HORIZONTAL 1
#define CP_MOVE_VERTICAL 2
#define CP_RESIZE_HORIZONTAL 4
#define CP_RESIZE_VERTICAL 8class CControlPos
{
public:
CControlPos(CWnd* pParent = NULL);
virtual ~CControlPos();public:
void SetParent(CWnd* pParent); BOOL AddControl(CWnd* pControl, const DWORD& dwStyle = CP_MOVE_HORIZONTAL);
BOOL AddControl(const UINT& unId, const DWORD& dwStyle = CP_MOVE_HORIZONTAL);
BOOL RemoveControl(CWnd* pControl);
BOOL RemoveControl(const UINT& unId);
void ResetControls(void);
virtual void MoveControls(void); //---------------------------------------------------
// most of the time, you don't want to move controls
// if the user reduces window size [controls can
// overlap and cause "issues"]
// negative moves won't move controls when the parent
// window is getting smaller than its original size
//
void SetNegativeMoves(const BOOL& fNegativeMoves = TRUE);
BOOL GetNegativeMoves(void) const;protected:
virtual void UpdateParentSize(void);private:
CWnd* m_pParent;
int m_nOldParentWidth;
int m_nOldParentHeight;
int m_nOriginalParentWidth;
int m_nOriginalParentHeight;
BOOL m_fNegativeMoves; CObArray m_awndControls;
};//----------------------------------------------------
// internal structure used to hold all information
// about a CWnd* control
//
typedef struct tagCONTROLDATA
{
HWND hControl; // HWND's never change; some MFC functions return temporary CWnd *'s
DWORD dwStyle; // check the #define's above
} CONTROLDATA, *LPCONTROLDATA;#endif
唯一能想到的可能了:搜索一下你整个工程中的文件,看是否有其他的文件里面也有如下这行:
#define CONTROLPOS_H_ 如果在其他头文件里面也有这个定义,那么在你的类所在头文件里面,可能无法引入这个class
注意大小写,等等
Add -> Existing Item -> 那个什么CPP文件。
一个小建议。 不一定对。 呵呵
#include "ControlPos.h"
最简单的是在你的类的头文件中类声明之前包含。
如还有问题,将代码打包发给我看看(打包前清理、删除DEBUG、Release目录)
不会是在CControlPos 类中吧?
如果是的话,类本身没有定义完,怎么实例化对象呢?
要在其他文件中实例化
不知道对你有没有帮助