Groups | Blog | Home
all groups > visual studio .net general > february 2006 >

visual studio .net general : QUERY: C++ programming


VManes
2/17/2006 10:50:00 PM
A common problem for those new to the VS environment.
When you make a new project, you will get a dialog "Win32 Application
Wizard - <project name>"
On this, you must select the Application Settings tab (which by the dark
blue coloring is not obviously a selectable tab!!), and there check the
Empty Project box. Then, when you add your file, it will be the only source
file and its main( ) will be seen as the start point.

Val

--
~~~~~~~~~~~~
"We've secretly switched the dilithium crystals with new Folger's
Crystals...
let's watch what happens."
~~~~~~~~~~~~
[quoted text, click to view]
This is about programming C++ using Visual Studio.NET 2002 & 2003.

I created a new Visual C++ project, Win32, Console application.

What's this?

_tmain(int argc, _TCHAR* argv[])

I had a self-contained C++ file that I added to the project along side the
ready-made _tmain() file. I tried to build the project but it kept on saying
reached eof, or couldn't find <iostream>. It probably was because VS didn't
like the alien carriage-returns.

Anyway, is there anything I need to know if I want to program like old-style
unmanaged C++? Besides the weird name _tmain() and _TCHAR, is there any
other nasty surprises I need to watch out for?




PS: What is the difference between vsnet and vstudio newsgroups?


Christoph Nahr
2/18/2006 12:00:00 AM
On Sat, 18 Feb 2006 01:13:08 -0000, "KevinGPO" <kevingpo@hotmail.com>
[quoted text, click to view]

That's Unicode. You don't use chars anymore on the Windows platform,
you use those _t/_T macros that map to either char (8 bit, ASCII/ANSI)
or wchar_t (16 bit, Unicode UCS-2/UTF-16) depending on whether you
define... umm... some appropriate constant (sorry, it's been some time
since I used C++).

Go hunt through the standard headers and search for _TCHAR and _tmain
in the MSDN library. I'm afraid you've got a lot of reading ahead of
you. All C++ library functions that operate on strings or characters
have _t equivalents, and you should use only those from now on.

That has nothing to do with .NET or managed code, by the way. That's
plain old unmanaged (Win32 native) handling of Unicode. When you're
writing managed code there's only System.Char and System.String, both
of which are always Unicode (16 bit, UTF-16).
--
KevinGPO
2/18/2006 1:13:08 AM
This is about programming C++ using Visual Studio.NET 2002 & 2003.

I created a new Visual C++ project, Win32, Console application.

What's this?

_tmain(int argc, _TCHAR* argv[])

I had a self-contained C++ file that I added to the project along side the
ready-made _tmain() file. I tried to build the project but it kept on saying
reached eof, or couldn't find <iostream>. It probably was because VS didn't
like the alien carriage-returns.

Anyway, is there anything I need to know if I want to program like old-style
unmanaged C++? Besides the weird name _tmain() and _TCHAR, is there any
other nasty surprises I need to watch out for?




PS: What is the difference between vsnet and vstudio newsgroups?

David Wilkinson
2/18/2006 7:27:54 AM
[quoted text, click to view]

In addition to Val's good advice, if you have files with non-Windows
line endings, you can fix them by using File->Advanced Save Options
(this is in VS2003).

KevinGPO
3/6/2006 12:00:00 AM
Hi guys

Am still getting compile errors.

I have a C++ cpp source file (just one, with a class and a standard main
function). It does however take in #include <iostream.h> and I have tried
the CXX 3rd edition version #include <ciostream> or #include <iostream>. But
the error message is always the same.

"fatal error C1010: unexpected end of file while looking for precompiled
header directive"

The line that it points to is right at the end of file. Probably it has
something to do with carriage-returns or something. The file was created in
Windows 2000/XP wordpad/notepad. I created a new Visual C++ Project, Win32
console. It did supply me with a stdafx.cpp and _main() function file, but I
replaced this with my own cpp source file.

My cpp source file compiles fine with Visual C++ 6.0. But why doesn't it
compile under Visual Studio.NET 2003?

Please someone help!

Kev
[quoted text, click to view]

Gerry Hickman
3/6/2006 9:58:25 PM
Hi,

That error is usually related to your stdafx and associated includes
being messed up. You may wish to create a new console app with the
wizard and then just follow it's structure...

[quoted text, click to view]


--
AddThis Social Bookmark Button