Solved

VC++ .NET

Posted on 2004-09-22
8
352 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
  • 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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now