Answered by:
Language and Syntax: C++ != C++/CLI?

Question
-
I'm not a beginner to the C++ language. I have written numerous console programs from a ballot to password protected Check Book. I decided I would now move on to GUI. I have run into some problems though:
1. I can not seem to find anything specific to VCPP 2010. I can find information about versions 2005, 2008, etc. The specific information I'm looking for is Language and syntax as well as how to write windows "forms" with VCPP.
2. It has been pointed out to me that C++ and C++/CLI are "completely different languages". What are the differences? What is C++/CLI? Do i need to know C++/CLI to use VCPP 2010? (and if so where can i find resources pertaining to language and syntax?)
I also need some references to these topics because I cant find them for Microsoft Visual C++ 2010:
-Language/Syntax (it is different than console... :/ )
- Writing windows "forms" with VCPP 2010
Your help is appreciated!
Thursday, March 8, 2012 12:10 AM
Answers
-
The language features are documented on MSDN here: http://msdn.microsoft.com/en-us/library/xey702bw.aspx
It is different - it's extending the C++ language to allow integration with the .NET framework. This includes things like handles (^) and "ref class" / "val class" / "ref struct" / etc.
Basically, you can use VC++ to write C++ without problems - you only need C++/CLI if you want to use the .NET Framework via C++ (which includes "Windows Forms", though you can, of course, create Windows programs using MFC and other "pure" C++ libraries as well).
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Thursday, March 8, 2012 12:16 AM -
Hi SpeakingCoutLoud,
Welcome to the MSDN Forum.
As we all know, C++/CLI represents a tuple. C++ refers, of course, to the C++ programming language. It supports a static object model that is optimized for the speed and size of its executable. CLI refers to the Common Language Infrastructure, a multitier architecture supporting a dynamic component programming model. More information about C++/CLI, please refer to this link: http://msdn.microsoft.com/en-us/magazine/cc163852.aspx.
We can create a Windows Forms Application with C++/CLI. While with native C++, you can only create Win32 Windows Application. If you want to know more information about the difference between creating the two application types, please refer to the following two documents in MSDN Library:
Creating Win32-Based Applications (C++)
Creating a Windows Forms Application By Using the .NET Framework (C++)What's more, you can refer to these articles for more information about creating Windows Forums application with VC++ .NET:
Windows Forms in Managed C++
Managed C++ and Windows Forms
Best regards,
Helen ZhaoHelen Zhao [MSFT]
MSDN Community Support | Feedback to us
- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Friday, March 9, 2012 2:58 AM -
C++/CLI is designed for .Net, using its own keywords to express managed array, properties, events, boxing etc that otherwise hard to write using C++. For example there is no way you can express a manage type in C++, Net's constructor behavior is different than standard C++'s.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Thursday, March 8, 2012 12:50 AM -
All of this is helpful, but i would like to know the library of cpp/cli and it's syntax. For example in C++ you display somthing using 'cout<< "string";', but if i want a label that changes accoring to variables in cpp/cli, then i need the syntax and the functions to do so. I dont have those resources and i would very much appreciate it if someone could provide them for me.
The link I pasted gives examples of the the syntax. As for converting from a C++/CLI object into a native string, see: http://msdn.microsoft.com/en-us/library/d1ae6tz5(v=vs.80).aspx
This shows how to convert from managed strings (ie: someObject->ToString()) to native strings in various formats.
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:29 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Monday, March 12, 2012 5:20 PM
All replies
-
The language features are documented on MSDN here: http://msdn.microsoft.com/en-us/library/xey702bw.aspx
It is different - it's extending the C++ language to allow integration with the .NET framework. This includes things like handles (^) and "ref class" / "val class" / "ref struct" / etc.
Basically, you can use VC++ to write C++ without problems - you only need C++/CLI if you want to use the .NET Framework via C++ (which includes "Windows Forms", though you can, of course, create Windows programs using MFC and other "pure" C++ libraries as well).
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Thursday, March 8, 2012 12:16 AM -
C++/CLI is designed for .Net, using its own keywords to express managed array, properties, events, boxing etc that otherwise hard to write using C++. For example there is no way you can express a manage type in C++, Net's constructor behavior is different than standard C++'s.
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Thursday, March 8, 2012 12:50 AM -
Hi SpeakingCoutLoud,
Welcome to the MSDN Forum.
As we all know, C++/CLI represents a tuple. C++ refers, of course, to the C++ programming language. It supports a static object model that is optimized for the speed and size of its executable. CLI refers to the Common Language Infrastructure, a multitier architecture supporting a dynamic component programming model. More information about C++/CLI, please refer to this link: http://msdn.microsoft.com/en-us/magazine/cc163852.aspx.
We can create a Windows Forms Application with C++/CLI. While with native C++, you can only create Win32 Windows Application. If you want to know more information about the difference between creating the two application types, please refer to the following two documents in MSDN Library:
Creating Win32-Based Applications (C++)
Creating a Windows Forms Application By Using the .NET Framework (C++)What's more, you can refer to these articles for more information about creating Windows Forums application with VC++ .NET:
Windows Forms in Managed C++
Managed C++ and Windows Forms
Best regards,
Helen ZhaoHelen Zhao [MSFT]
MSDN Community Support | Feedback to us
- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:28 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Friday, March 9, 2012 2:58 AM -
All of this is helpful, but i would like to know the library of cpp/cli and it's syntax. For example in C++ you display somthing using 'cout<< "string";', but if i want a label that changes accoring to variables in cpp/cli, then i need the syntax and the functions to do so. I dont have those resources and i would very much appreciate it if someone could provide them for me.
Sunday, March 11, 2012 1:26 AM -
All of this is helpful, but i would like to know the library of cpp/cli and it's syntax. For example in C++ you display somthing using 'cout<< "string";', but if i want a label that changes accoring to variables in cpp/cli, then i need the syntax and the functions to do so. I dont have those resources and i would very much appreciate it if someone could provide them for me.
The link I pasted gives examples of the the syntax. As for converting from a C++/CLI object into a native string, see: http://msdn.microsoft.com/en-us/library/d1ae6tz5(v=vs.80).aspx
This shows how to convert from managed strings (ie: someObject->ToString()) to native strings in various formats.
Reed Copsey, Jr. - http://reedcopsey.com
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".- Proposed as answer by Helen Zhao Tuesday, March 13, 2012 7:29 AM
- Marked as answer by Helen Zhao Thursday, March 15, 2012 1:13 AM
Monday, March 12, 2012 5:20 PM