Compiling errors
-
http://www.codeproject.com/dialog/msgboxdemo.asp?df=100&forumid=1419&exp=0&select=632516#xx632516xx According to the above, I created a MFC-AppWizard exe project(Dialog-based) and added the files "timedmsgbox.cpp" and "timedmsgbox.h" to it,then changed the afximpl.h path as: #include "C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\SRC\\afximpl.h" My computer's OS is WindowsXP sp2 Compiling tool is VC6 The compiling result is like the below How can I solve these problems? Compiling... timedmsgbox.cpp d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2501: 'm_sectMap' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2039: 'm_sectMap' : is not a member of 'CDlgTimedMessageBox' d:\projects\timedmsgboxtest\timedmsgbox.h(23) : see declaration of 'CDlgTimedMessageBox' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2501: 'CCriticalSection' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : fatal error C1004: unexpected end of file found Error executing cl.exe. TimedMsgBoxTest.exe - 6 error(s), 0 warning(s)
-
http://www.codeproject.com/dialog/msgboxdemo.asp?df=100&forumid=1419&exp=0&select=632516#xx632516xx According to the above, I created a MFC-AppWizard exe project(Dialog-based) and added the files "timedmsgbox.cpp" and "timedmsgbox.h" to it,then changed the afximpl.h path as: #include "C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\SRC\\afximpl.h" My computer's OS is WindowsXP sp2 Compiling tool is VC6 The compiling result is like the below How can I solve these problems? Compiling... timedmsgbox.cpp d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2501: 'm_sectMap' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2039: 'm_sectMap' : is not a member of 'CDlgTimedMessageBox' d:\projects\timedmsgboxtest\timedmsgbox.h(23) : see declaration of 'CDlgTimedMessageBox' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2501: 'CCriticalSection' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : fatal error C1004: unexpected end of file found Error executing cl.exe. TimedMsgBoxTest.exe - 6 error(s), 0 warning(s)
Add
<afxmt.h>
to yourStdAfx.h
header file, then Rebuild All. -
http://www.codeproject.com/dialog/msgboxdemo.asp?df=100&forumid=1419&exp=0&select=632516#xx632516xx According to the above, I created a MFC-AppWizard exe project(Dialog-based) and added the files "timedmsgbox.cpp" and "timedmsgbox.h" to it,then changed the afximpl.h path as: #include "C:\\Program Files\\Microsoft Visual Studio\\VC98\\MFC\\SRC\\afximpl.h" My computer's OS is WindowsXP sp2 Compiling tool is VC6 The compiling result is like the below How can I solve these problems? Compiling... timedmsgbox.cpp d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' d:\projects\timedmsgboxtest\timedmsgbox.h(44) : error C2501: 'm_sectMap' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2039: 'm_sectMap' : is not a member of 'CDlgTimedMessageBox' d:\projects\timedmsgboxtest\timedmsgbox.h(23) : see declaration of 'CDlgTimedMessageBox' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2146: syntax error : missing ';' before identifier 'm_sectMap' D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : error C2501: 'CCriticalSection' : missing storage-class or type specifiers D:\projects\TimedMsgBoxTest\timedmsgbox.cpp(28) : fatal error C1004: unexpected end of file found Error executing cl.exe. TimedMsgBoxTest.exe - 6 error(s), 0 warning(s)
Hi, I hope you have solved the current problem as replied by Mike. When u get error as above, "error C2501: 'CCriticalSection' : missing storage-class or type specifiers", immidiately search "CCriticalSection" on MSDN. There you will get header file u need to include. Compiler follows set of instructions. If u forget including header files, it will throw error like above. Error numbers reported by VC compilers are described in detail on MSDN. If u get compiler concepts clear, u will never face problem in solving such errors. The chosen One :)
-
Add
<afxmt.h>
to yourStdAfx.h
header file, then Rebuild All.It work well now Thank you!
-
Hi, I hope you have solved the current problem as replied by Mike. When u get error as above, "error C2501: 'CCriticalSection' : missing storage-class or type specifiers", immidiately search "CCriticalSection" on MSDN. There you will get header file u need to include. Compiler follows set of instructions. If u forget including header files, it will throw error like above. Error numbers reported by VC compilers are described in detail on MSDN. If u get compiler concepts clear, u will never face problem in solving such errors. The chosen One :)
Great! What a good lesson! I don't know what to do about these errors before. Thanks a lot for both of you! :rose::rose::rose: