一直`class`has no member named`XXX`

serflygod 2011-09-24 12:34:39
如題

程式是從別人那邊拿過來的
確定原本可以正確運行

但在我自己的電腦上面跑就出錯

像是其中一個class:


class msb_tree {
bool **bitPlane; //Bits, from top to low [0~tree_depth]
int *width, *height;
int tree_depth;

public:

msb_tree(int baseWidth, int baseHeight);

~msb_tree();

void build() {
bool tmp[4]={false,false,false,false};
int x, y, i, j, k;
for(i=tree_depth-2;i > -1;i--) {

for(y=0;y<height[i];y++)
for(x=0;x<width[i];x++)
{
for(k=0;k<2;k++)
for(j=0;j<2;j++){
if( ((2*x+j) < width[i+1]) && ((2*y+k) < height[i+1] ) )
tmp[k*2+j] = bitPlane[i+1][(2*y+k)*width[i+1]+2*x+j];
else
tmp[k*2+j] = false;
}

bitPlane[i][y*width[i]+x] = bitMax(tmp[0], tmp[1], tmp[2], tmp[3]);
}
}
}

void putLeaf(int x, int y, bool symbol) {
bitPlane[tree_depth-1][y*width[tree_depth-1]+x] = symbol;
}

bool getBit(int level, int x, int y) {
if(x < width[level])
return bitPlane[level][y*width[level]+x];
else
return false;
}


但結果報錯說'class msb_tree' has no member named 'putLeaf'

但明明就是有宣告了啊...
...全文
3621 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
serflygod 2011-09-24
  • 打赏
  • 举报
回复
在想是不是原先那個人是用QT寫的
而我是使用code::block開
才會造成這麼多問題
serflygod 2011-09-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fox000002 的回复:]

少了一个 }

解析出错了
[/Quote]
不好意思
我發現我少複製一行

真正原本應該是這樣

class msb_tree {
bool **bitPlane; //Bits, from top to low [0~tree_depth]
int *width, *height;
int tree_depth;

public:

msb_tree(int baseWidth, int baseHeight);

~msb_tree();

void build() {
bool tmp[4]={false,false,false,false};
int x, y, i, j, k;
for(i=tree_depth-2;i > -1;i--) {

for(y=0;y<height[i];y++)
for(x=0;x<width[i];x++)
{
for(k=0;k<2;k++)
for(j=0;j<2;j++){
if( ((2*x+j) < width[i+1]) && ((2*y+k) < height[i+1] ) )
tmp[k*2+j] = bitPlane[i+1][(2*y+k)*width[i+1]+2*x+j];
else
tmp[k*2+j] = false;
}

bitPlane[i][y*width[i]+x] = bitMax(tmp[0], tmp[1], tmp[2], tmp[3]);
}
}
}

void putLeaf(int x, int y, bool symbol) {
bitPlane[tree_depth-1][y*width[tree_depth-1]+x] = symbol;
}

bool getBit(int level, int x, int y) {
if(x < width[level])
return bitPlane[level][y*width[level]+x];
else
return false;
}

int getTreeDepth() {
return tree_depth;
}

int getwidth(int level) {
return width[level];
}
int getHieght(int level) {
return height[level];
}

bool isLeaf(int level) {
if(level == (tree_depth-1))
return true;
else
return false;
}
};
fox000002 2011-09-24
  • 打赏
  • 举报
回复
少了一个 }

解析出错了
======================================================================== MICROSOFT FOUNDATION CLASS LIBRARY : Test ======================================================================== AppWizard has created this Test application for you. This application not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your application. This file contains a summary of what you will find in each of the files that make up your Test application. Test.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. Test.h This is the main header file for the application. It includes other project specific headers (including Resource.h) and declares the CTestApp application class. Test.cpp This is the main application source file that contains the application class CTestApp. Test.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. Test.clw This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions. res\Test.ico This is an icon file, which is used as the application's icon. This icon is included by the main resource file Test.rc. res\Test.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file. ///////////////////////////////////////////////////////////////////////////// AppWizard creates one dialog cla
MICROSOFT FOUNDATION CLASS LIBRARY : ChatClient AppWizard has created this ChatClient application for you. This application not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your application. This file contains a summary of what you will find in each of the files that make up your ChatClient application. ChatClient.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. ChatClient.h This is the main header file for the application. It includes other project specific headers (including Resource.h) and declares the CChatClientApp application class. ChatClient.cpp This is the main application source file that contains the application class CChatClientApp. ChatClient.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. ChatClient.clw This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions. resChatClient.ico This is an icon file, which is used as the application s icon. This icon is included by the main resource file ChatClient.rc. resChatClient.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file For the main frame window: MainFrm.h, MainFrm.cpp These files contain the frame class CMainFrame, which is derived from CFrameWnd and controls all SDI frame features. resToolbar.bmp This bitmap file is used to create tiled images for the toolbar. The initial toolbar and status bar are constructed in the CMainFrame class. Edit this toolbar bitmap using the resource editor, and update the IDR_MAINFRAME TOOLBAR array in ChatClient.rc to add toolbar buttons. AppWizard creates one document type and one view: ChatClientDoc.h, ChatClientDoc.cpp - the document These files contain your CChatClientDoc class. Edit these files to add your special document data and to implement file saving and loading (via CChatClientDoc::Serialize). ChatClientView.h, ChatClientView.cpp - the view of the document These files contain your CChatClientView class. CChatClientView objects are used to view CChatClientDoc objects. Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file named ChatClient.pch and a precompiled types file named StdAfx.obj. Resource.h This is the standard header file, which defines new resource IDs. Microsoft Visual C++ reads and updates this file. Other notes: AppWizard uses "TODO:" to indicate parts of the source code you should add to or customize. If your application uses MFC in a shared DLL, and your application is in a language other than the operating system s current language, you will need to copy the corresponding localized resources MFC42XXX.DLL from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. For example, MFC42DEU.DLL contains resources translated to German.) If you don t do this, some of the UI elements of your application will remain in the language of the operating system.
MICROSOFT FOUNDATION CLASS LIBRARY : CNIcq AppWizard has created this CNIcq application for you. This application not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your application. This file contains a summary of what you will find in each of the files that make up your CNIcq application. CNIcq.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. CNIcq.h This is the main header file for the application. It includes other project specific headers (including Resource.h) and declares the CCNIcqApp application class. CNIcq.cpp This is the main application source file that contains the application class CCNIcqApp. CNIcq.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. CNIcq.clw This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions. resCNIcq.ico This is an icon file, which is used as the application s icon. This icon is included by the main resource file CNIcq.rc. resCNIcq.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file AppWizard creates one dialog class: CNIcqDlg.h, CNIcqDlg.cpp - the dialog These files contain your CCNIcqDlg class. This class defines the behavior of your application s main dialog. The dialog s template is in CNIcq.rc, which can be edited in Microsoft Visual C++. Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file named CNIcq.pch and a precompiled types file named StdAfx.obj. Resource.h This is the standard header file, which defines new resource IDs. Microsoft Visual C++ reads and updates this file. Other notes: AppWizard uses "TODO:" to indicate parts of the source code you should add to or customize. If your application uses MFC in a shared DLL, and your application is in a language other than the operating system s current language, you will need to copy the corresponding localized resources MFC42XXX.DLL from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. For example, MFC42DEU.DLL contains resources translated to German.) If you don t do this, some of the UI elements of your application will remain in the language of the operating system.
MICROSOFT FOUNDATION CLASS LIBRARY : xLANInfo AppWizard has created this xLANInfo application for you. This application not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your application. This file contains a summary of what you will find in each of the files that make up your xLANInfo application. xLANInfo.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. xLANInfo.h This is the main header file for the application. It includes other project specific headers (including Resource.h) and declares the CXLANInfoApp application class. xLANInfo.cpp This is the main application source file that contains the application class CXLANInfoApp. xLANInfo.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. xLANInfo.clw This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions. resxLANInfo.ico This is an icon file, which is used as the application s icon. This icon is included by the main resource file xLANInfo.rc. resxLANInfo.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file. AppWizard creates one dialog class: xLANInfoDlg.h, xLANInfoDlg.cpp - the dialog These files contain your CXLANInfoDlg class. This class defines the behavior of your application s main dialog. The dialog s template is in xLANInfo.rc, which can be edited in Microsoft Visual C++. Other standard files: StdAfx.h, StdAfx.cpp These files are used to build a precompiled header (PCH) file named xLANInfo.pch and a precompiled types file named StdAfx.obj. Resource.h This is the standard header file, which defines new resource IDs. Microsoft Visual C++ reads and updates this file. Other notes: AppWizard uses "TODO:" to indicate parts of the source code you should add to or customize. If your application uses MFC in a shared DLL, and your application is in a language other than the operating system s current language, you will need to copy the corresponding localized resources MFC42XXX.DLL from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. For example, MFC42DEU.DLL contains resources translated to German.) If you don t do this, some of the UI elements of your application will remain in the language of the operating system.
千年封包解密库 MICROSOFT FOUNDATION CLASS LIBRARY : SubPacket AppWizard has created this SubPacket application for you. This application not only demonstrates the basics of using the Microsoft Foundation classes but is also a starting point for writing your application. This file contains a summary of what you will find in each of the files that make up your SubPacket application. SubPacket.dsp This file (the project file) contains information at the project level and is used to build a single project or subproject. Other users can share the project (.dsp) file, but they should export the makefiles locally. SubPacket.h This is the main header file for the application. It includes other project specific headers (including Resource.h) and declares the CSubPacketApp application class. SubPacket.cpp This is the main application source file that contains the application class CSubPacketApp. SubPacket.rc This is a listing of all of the Microsoft Windows resources that the program uses. It includes the icons, bitmaps, and cursors that are stored in the RES subdirectory. This file can be directly edited in Microsoft Visual C++. SubPacket.clw This file contains information used by ClassWizard to edit existing classes or add new classes. ClassWizard also uses this file to store information needed to create and edit message maps and dialog data maps and to create prototype member functions. resSubPacket.ico This is an icon file, which is used as the application s icon. This icon is included by the main resource file SubPacket.rc. resSubPacket.rc2 This file contains resources that are not edited by Microsoft Visual C++. You should place all resources not editable by the resource editor in this file. AppWizard creates one dialog class: SubPacketDlg.h, SubPacketDlg.cpp - the dialog These files contain your CSubPacketDlg class. This class defines the be

64,687

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧