Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VC++ .NET

Posted on 2004-09-22
8
Medium Priority
?
360 Views
Last Modified: 2010-04-01
I just installed VC++ .NET (7.1).  When trying to write a test console app, it seems that the syntax for everything may be different....  anyone else had this experience?
0
Comment
Question by:fattumsdad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 12125332
int _tmain(int argc, _TCHAR* argv[])
{
      return 0;
}

The _tmain function is a macro for either wmain or main (UNICODE char set used or not).
So is the TCHAR, a macro for either wchar_t or char.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 12125352
So if you do not use UNICODE, the code will look like this (to the compiler) :

int main(int argc, char* argv[])
{
      return 0;
}

If you use UNICODE:

int wmain(int argc, wchar_t* argv[])
{
      return 0;
}

..if that's what you mean by "it seems that the syntax for everything may be different"
0
 
LVL 86

Expert Comment

by:jkr
ID: 12125390
You need to use an _unmanaged_ project, since otherwise, everything will be *very* different. E.g. a simple "Hello World!" mutates to

#using <mscorlib.dll>

// Allow easy reference to the System namespace classes.
using namespace System;

// The global function, main, is the application's entry point.
void main() {
   // Write text to the console.
   Console::WriteLine(S"Hello World using Managed Extensions for C++!");
}

See e.g. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptutorials/html/hello_world_in_managed_extensions_for_c__.asp ("Hello World in Managed Extensions for C++")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:fattumsdad
ID: 12125435
So if I use an unmanaged project, I should be able to continue with the syntax that I'm used to?  

#include <iostream>

using namespace std (or would it have to be "system");

int main()
{
   var whatever;

   cout << "xxxxxXx
   cin >> var

   return 0;
}
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 12125487
>> So if I use an unmanaged project, I should be able to continue with the syntax that I'm used to?

Yup, absolutely, a simple

#include <iostream>

using namespace std;

int main()
{
  float fPrice;

  cout << "Hello World, what's your price?" << endl;
  cin >> fPrice;

  return 0;
}

will do.
0
 
LVL 1

Author Comment

by:fattumsdad
ID: 12125515
Excellent!  I appreciate the help.  Another question...  different subject...  how familiar are you with C# and J#?
0
 
LVL 86

Expert Comment

by:jkr
ID: 12125549
>>how familiar are you with C# and J#?

Zero. Nada. Niente. I can spell their names, though :o)
0
 
LVL 1

Author Comment

by:fattumsdad
ID: 12125562
LOL that makes two of us...  I want to learn C# but I hear it's basically Java with a different name....  no idea what this J# is.  I guess I should just stick with C++ LOL I'm years away from coming close to mastering that!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question