New to C++

D

drg

I have studied Java and C# but want to get to know C++ as well and,
well, I am already confused. I am studying from Microsoft visual
C++.net (2003) and compiling on visual studio c++ express 2005.

when I try to compile:

Console::WriteLine(S"Hello World")

I get an error.

If I compile:

Console::WriteLine(L"Hello World")

it is able to build.

Is the 'S' deprecated? If so, has C++ changed that much between 2003
and 2005. I'm afraid to tackle 2008.

Maybe I should just stick with Java and C#

Thanks in advance.

DRG
 
J

Jerry Coffin

drg62 said:
I have studied Java and C# but want to get to know C++ as well and,
well, I am already confused. I am studying from Microsoft visual
C++.net (2003) and compiling on visual studio c++ express 2005.

when I try to compile:

Console::WriteLine(S"Hello World")

I get an error.

If I compile:

Console::WriteLine(L"Hello World")

it is able to build.

From the looks of things, you're not using C++ at all. Neither one of
these should compile.
Is the 'S' deprecated? If so, has C++ changed that much between 2003
and 2005. I'm afraid to tackle 2008.

My guess is that you're using what Microsoft calls C++/CLI. The name is
deceiving you -- your code is not really C++ at all.
Maybe I should just stick with Java and C#

Or with actual C++. The last time it changed was 2003, and you have to
be nearly an expert to find any of the changes that took place at that
time. The real C++ language hasn't changed enough to notice in over 10
years now. What you seem to be doing above would look something like:
std::cout << "Hello World"; in C++.
 
D

drg

Jerry said:
From the looks of things, you're not using C++ at all. Neither one of
these should compile.


My guess is that you're using what Microsoft calls C++/CLI. The name is
deceiving you -- your code is not really C++ at all.

Ahhh -- you having said that made me look back to the previous chapter
where I was introduced to Managed Extensions for C++(MC++).

Thanks
 
C

Christopher

drg said:
I have studied Java and C# but want to get to know C++ as well and, well, I
am already confused. I am studying from Microsoft visual C++.net (2003)
and compiling on visual studio c++ express 2005.

when I try to compile:

Console::WriteLine(S"Hello World")

I get an error.

If I compile:

Console::WriteLine(L"Hello World")

it is able to build.

Is the 'S' deprecated? If so, has C++ changed that much between 2003 and
2005. I'm afraid to tackle 2008.

Maybe I should just stick with Java and C#

Thanks in advance.

DRG

You are not using C++, but rather Microsoft's own "managed" C++ or C++.NET
language , which is a completely differant language altogether.
 
T

tragomaskhalos

Thats visual basic, which can be embedded in C++ with the VC compiler.
You do have to set some option when compiling though. But since you
want to learn C++ you shouldn't use that :). I got my basics fromhttp://www.cplusplus.com/doc/tutorial/introduction.htmland did the
tutorial of VC, which also includes how you can compile VB code in c++.

I assume this is a joke (because it's complete nonsense), but really,
people have enough difficulty working out from Microsoft documentation
what's standard C++ and what are extensions | managed C++ | C++/CLI
without confusing them further.
 
B

Bo Persson

drg said:
Ahhh -- you having said that made me look back to the previous
chapter where I was introduced to Managed Extensions for C++(MC++).

That's the first attempt, which wasn't very successful. C++/CLI is
another language, also invented by Microsoft.

The you have the real C++, the ISO standard C++ language. Visual
Studio will do that as well, if you just set the appropriate switches.


Bo Persson
 
P

pelio

Jerry Coffin a écrit :
From the looks of things, you're not using C++ at all. Neither one of
these should compile.


My guess is that you're using what Microsoft calls C++/CLI. The name is
deceiving you -- your code is not really C++ at all.

The line:

Console::WriteLine(L"Hello World")

is C++ - call of WriteLine static method in class Console with
declaration for example void WriteLine(const wchar_t *msg)
 
J

Jerry Coffin

[ ... ]
The line:

Console::WriteLine(L"Hello World")

is C++ - call of WriteLine static method in class Console with
declaration for example void WriteLine(const wchar_t *msg)

It's certainly possible to write C++ that makes this legitimate. It's
equally certain that C++ doesn't support this right out of the box, so
to speak -- i.e. the standard library doesn't include a class named
Console with a member named WriteLine. Equally valid would be a
namespace named Console with a function named WriteLine -- but that's
not included in the C++ standard library either.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,183
Messages
2,570,967
Members
47,518
Latest member
RomanGratt

Latest Threads

Top