In a dialog I had replaced an CListBox with CListCtrl ... the old CListBox had used SetItemDataPtr, to store a CMyObjects pointers ... but CListCtrl does not have not such a thing (CListCtrl::SetItemDataPtr, only CListCtrl::SetItemData) ... how can I store an object pointers into CListCtrl ? Is it posible ?
Thank you so much for your answers (both of you), I will try that right away and tell you what I've done ... but it came into my mind a question ... if I could store pointers into SetItemData(...), why CListBox does have SetItemData and SetItemDataPtr ... it is not a kind of redundancy ?
I can't see anything seriously wrong in the posted code. So the error may be also somewhere else (probably in a line before number 33 in mydialog.cpp). A possible error source is forgetting the trailing semicolon after the class declaration:
class CMyDialog : public CDialog
}; // <- Don't forget the semicolon here.
I have some more notes:
You should always use parentheses with definitions and macros:
Such mistakes happen (even to me after years of programming). When forgetting the semicolon at the end of a header file, the error is thrown at the first semicolon in the next file which might be another header file or the source file. If you remember this and get such a bulk of messages the next time, you will probably know where to look first.
It seems that one of the major obstacles in developing a real application is lack of understanding of one of the fundamental language features – in this case C preprocessor. Majority of coding articles posted here ignore such details.
I am sure this can be applied to any C derivative - C++, C# and other languages.
I think I got the basics, but would like to know how compiler applies stuff like “dependencies” , settings – preprocessor “additional includes” and “Options – directories”.
Of course I am using VS/VC 6.0 terminology and it will be different in later VS IDE's
Any educational commentaries are much appreciated. References, links etc would be great.
And after this discussion is done, I'll ask about usage of #pragma – I am currently using it to stop the compiler when there are too many initial error. Crude but works for me.
Appreciate your time.
would like to know how compiler applies stuff like “dependencies” , settings – preprocessor “additional includes” and “Options – directories”.
It doesn't, these are merely convenient ways of indicating how your source code should be compiled, and all are used by Visual Studio to build the command and options used to invoke the compiler. The preprocessor reads the source file, expands #included sources and macros, and passes the resulting source to the actual compiler. You can set options in VS to get the output of the preprocessor saved to a file.
And after this discussion is done, I'll ask about usage of #pragma
in VS\VC 6.0 there is an *.opt file which comes from "Options".
(For now I forgot how to get to the compiler command line itself.)
An easy way to change path used during development at once, I am using plain Notepad.
I have not found a way to do it in IDE itself.
Acually this post was promted by me being curious if the sequence of "includes" in Option setting matters. I guess I shall test that after I get my app to work again - my XP crashed!
Thanks for your time.
I'm afraid it's quite a few years since I used VC 6, and it was quite different in many ways from the Visual Studio versions. However, you should be able to check and see all the various items by using the Project -> Properties link in the solution explorer.