Original Post
I received the following error ( see below) in VC2005, when I tried to initialize the CString that I added in the header file. But don't received the error when I initialize it the .cpp file. THIS DOESN"T WORK THIS DOES WORK: I get the following errors if I do the first setup: Lastly, can anyone tell me where I would find the returned value of AfxMessageBox is? I know it's an int, but thought originally it would be a Sting (i.e MB_OK).
SourceSnipITView.h
...
...
CString AfxMsg;
AfxMsg = "message goes here";
SourceSnipITView.cpp
...
...
AfxMessageBox(AfxMsg, MB_OKCANCEL);
SourceSnipITView.h
public:
CString AfxMsg;
SourceSnipITView.cpp
AfxMsg = "message goes here"
AfxMessageBox(AfxMsg, MB_OKCANCEL);
------ Build started: Project: SourceSnipIT, Configuration: Debug Win32 ------
Compiling...
SourceSnipITView.cpp
c:\documents and settings\c00smm\my documents\visual studio 2005\projects\sourcesnipit\sourcesnipit\sourcesnipitview.h(74) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\c00smm\my documents\visual studio 2005\projects\sourcesnipit\sourcesnipit\sourcesnipitview.h(74) : error C2864: 'CSourceSnipITView::AfxMsg' : only static const integral data members can be initialized within a class
Generating Code...
Compiling...
SourceSnipIT.cpp
c:\documents and settings\c00smm\my documents\visual studio 2005\projects\sourcesnipit\sourcesnipit\sourcesnipitview.h(74) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\documents and settings\c00smm\my documents\visual studio 2005\projects\sourcesnipit\sourcesnipit\sourcesnipitview.h(74) : error C2864: 'CSourceSnipITView::AfxMsg' : only static const integral data members can be initialized within a class
Generating Code...
Build log was saved at "file://c:\Documents and Settings\c00smm\My Documents\Visual Studio 2005\Projects\SourceSnipIT\SourceSnipIT\Debug\BuildLog.htm"
SourceSnipIT - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========