Solved

VC++ .NET

Posted on 2004-09-22
8
357 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
Technology Partners: 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 500 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

Suggested Solutions

Title # Comments Views Activity
C language IDE – Compilers installation 14 96
Unable to start eclipse ? 17 176
Add values of each row in an array 3 81
c++  placing data into a form and an editbox 5 50
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

752 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