C++ as a .NET language

This is a discussion on C++ as a .NET language within the C++ Programming forums, part of the General Programming Boards category; I originally learned C# because I had given up looking for a tutorial on how to do C++ in .NET. ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    C++ as a .NET language

    I originally learned C# because I had given up looking for a tutorial on how to do C++ in .NET. I have Visual Studio .NET, and downloaded the plug-in to handle C++ projects, etc... but before I start coding I had a few questions:

    1) Can I still use graphics libraries and other APIs as normal in C++.NET, even if they are written for regular C++?

    2) Do I include files using #include or 'using? Actually this whole concept is confusing me. If I want to use the standard C++ libraries, I've seen people use something like 'using std', but I assume I also have access to the .NET namespaces, right?

    Thanks a lot if anybody can help.

  2. #2
    'AlHamdulillah
    Join Date
    Feb 2003
    Posts
    790
    1) Can I still use graphics libraries and other APIs as normal in C++.NET, even if they are written for regular C++?
    yes you can still use them as you would in any previous version of C++.NET, in fact IIRC there arent any real differences in .NET for C++ besides an improved compiler.

    2) Do I include files using #include or 'using? Actually this whole concept is confusing me. If I want to use the standard C++ libraries, I've seen people use something like 'using std', but I assume I also have access to the .NET namespaces, right?
    you use #include like in all ANSI standard C/++ compilers. What I believe you have seen is "using namespace std". If so, that is also ANSI standard and acts somewhat like C#'s using, but if you have the MSDN disks , do a quick read through on the namespace references.

    and finally, I really cannot answer on the last question, as I have never used .NET namespaces.
    there used to be something here, but not anymore

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    If you mean the namespaces you use in C# (System and those) then no, you dont have access to those in C++.

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Thank you - this helps a lot

  5. #5
    Registered User big146's Avatar
    Join Date
    Apr 2003
    Posts
    74
    You can still write standard C++ using visual studio.Net.Just use the standard syntax and #inlcude<files>. You cannot use the Net. namespaces for use in a standard C++ program.

    instead of #using macorlib.dll ( or what ever it is ) You would just use the appropriate #include <files>.

    Also if you wanted to write a console program you would use win32 console project instead of a console application(Net).

    Looking at the first line above.....you could port a standard C++ program to a Net program( just thought i woudl throw that in so you knew).

    i.e instead of using Console.WriteLine(S"blablab");
    In C++ it would be(assuming your using namespace std)
    cout << "blabla" << endl;

    Hope this help clear it up a little for ya.
    big146

  6. #6
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Alright - I've figured it out now. So for anyone searching the forums: just add

    Code:
    using namespace std;
    to your code and then it's like regular old C++.

  7. #7
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can use the .NET CLR from C++. It is called "managed extensions for C++" and can be mixed with "unmanaged" C++.

    http://www.ondotnet.com/pub/a/dotnet...intromcpp.html
    http://msdn.microsoft.com/msdnmag/issues/01/07/vsnet/
    http://www.google.com/search?q=managed+code+C%2B%2B

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A VS .NET 2002 installation question
    By Joelito in forum Windows Programming
    Replies: 1
    Last Post: 07-22-2005, 08:48 AM
  2. Some .NET Distribution Stats
    By nickname_changed in forum C# Programming
    Replies: 2
    Last Post: 05-14-2005, 04:41 AM
  3. making a dll in .net 2.0 and than using it in .net 1.1
    By Rune Hunter in forum C# Programming
    Replies: 2
    Last Post: 04-19-2005, 02:59 PM
  4. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 02:20 AM
  5. Why?
    By gprime in forum C++ Programming
    Replies: 5
    Last Post: 06-13-2004, 05:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21