• 0

Please Help On C++.net


Question

hi

i am using vs.net academic.

unlike vs6 when u can compile .cpp files and see the output in command prompt like cout<<"hello", you would see hello in command dos prompt.

for some reason i cant do it vs.net. PLEASE HELP

thnx

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

In Visual C++ 6.0, you had to make sure you were making a a Win32 console app when you go to File...New, I don't have C++ .Net but you should still be able to make console apps. Its supposed to be a suite to learn C++ on and they wouldn't have gotten rid of console apps as a result.

Link to comment
Share on other sites

  • 0

did you remember to add the include file??? what was it... like

#include

that header is needed for console out ( cout << ) to work i think

Link to comment
Share on other sites

  • 0

yea i did

this was my code

#include

using namespace std;

void main()

{

cout<<"hello worldn";

}

this builds and compiles but the command prompt doesnt show up and i want to see hello world in the command prompt window

thnx

Link to comment
Share on other sites

  • 0

it prob does show up but really fast. that code will execute then kill the window. u need to put in a cmd that will w8 for input like a fake kb read.

edit:

try ..

#include

using namespace std;

void main()

{

int stop = 0;

cout<<"hello worldn";

cin >> stop;

}

Link to comment
Share on other sites

  • 0
Originally posted by reactionary007

if you use getch() though i think you have to include

not positive though... haven't used c++ in awhile

Yeah, the conio.h library (console input/output) contains functions like clrscr(), clreol(), getche(), getch() and gotoxy(x,y)

I wouldn't even bother using VC++.NET for a year or two, the .NET platform is relatively new and not that many people have the .NET framework installed.

Link to comment
Share on other sites

  • 0
Originally posted by caustiK

shouldn't it be instead of ?

won't compile in my .net. (using .net cause the university gave me the license - could care less whether i use all the functions :) )

If you use you have to define the namespace, for example: std::cout << "Hello me"; or you can just write this line:

using namespace std; then you can use the same way as with . As the matter of fact, is the newer version of .

Link to comment
Share on other sites

  • 0
Originally posted by JZolloXP

Yeah, the conio.h library (console input/output) contains functions like clrscr(), clreol(), getche(), getch() and gotoxy(x,y)

I wouldn't even bother using VC++.NET for a year or two, the .NET platform is relatively new and not that many people have the .NET framework installed.

can't u include the framework in the install of your program like with Visual Studio Installer?

Link to comment
Share on other sites

  • 0
Originally posted by kman1985

can't u include the framework in the install of your program like with Visual Studio Installer?

Hehe, the .NET framework is 20MB+

Thanks a lot microsoft :right:

Link to comment
Share on other sites

  • 0

You don't need the framework for win32 C/C++. It compiles just like it did in VS 6 to a binary, not IL. Just create a new VC++ project, select Win32, and when the wizard comes up, select the Application tab on the left, and change the project settings to whatever you're doing, in this case a Console App.

You can do it via command line as well, but you have to set up some environment variables to point to VC7's, bin, includes and libs( under the VC7 dir ), and the location of the debug libs in the CommonTools directory. You also have to specify to the compiler( cl.exe ) that you are using C++ exception handling semantics in the linker options( /EHsc ).

Link to comment
Share on other sites

  • 0
Originally posted by weenur

You don't need the framework for win32 C/C++. It compiles just like it did in VS 6 to a binary, not IL. Just create a new VC++ project, select Win32, and when the wizard comes up, select the Application tab on the left, and change the project settings to whatever you're doing, in this case a Console App.

You can do it via command line as well, but you have to set up some environment variables to point to VC7's, bin, includes and libs( under the VC7 dir ), and the location of the debug libs in the CommonTools directory. You also have to specify to the compiler( cl.exe ) that you are using C++ exception handling semantics in the linker options( /EHsc ).

then how am i able to compile VB.NET and C++.NET Together? hmm?

in order to use the CLR it must all compile down to IL.

Link to comment
Share on other sites

  • 0
Originally posted by uniacid

hey guys since were talkin about c++, can you recommend me to some good books or tutorials for c++, my teacher sux at teaching and the book is old :ermm:

VC++ 6 or VC++.net ?

Link to comment
Share on other sites

  • 0

well I dun got .Net ;) only at school :ermm: which is gay but I like C++ Builder rather than MSVSC (VC++ 6) but I do got that also.

But any is fine, b/c imma try to get C++ .Net soon

Link to comment
Share on other sites

  • 0
then how am i able to compile VB.NET and C++.NET Together? hmm?

in order to use the CLR it must all compile down to IL.

Uh... that isn't what I was talking about. You can write a C++ app that isn't CLR/IL in Visual Studio .NET, which wouldn't require the redistribution of the framework. That is all that I was saying. It seemed to me that there was some confusion on writing traditional C++ apps in VS.NET, so I was merely trying to clear it up. I guess I didn't do that good of a job. :cross:

You can interoperate between CLR apps and "traditional" apps fairly seamlessly from what I've seen, so you can mix unmanaged code with VB.NET and indirectly leverage the CLR.

hey guys since were talkin about c++, can you recommend me to some good books or tutorials for c++, my teacher sux at teaching and the book is old

A First Book of C++ by Gary J. Bronson. ISBN 0-534-36801-8

A surprisingly good book. Very easy to understand, and accomodates Visual C++ 5.0 & 6.0 and Borland's C++ Builder. Also has a couple of detachable quick reference cards that have all sorts of handy info on them.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.