cout<<...

Started by
12 comments, last by Gabriel Fleseriu 21 years, 11 months ago
I'm looking for 15 minutes to this piece of code, and I really can't figure out why the fuck it does not print anything. I probably am too tired, or I don't know... Any ideas?
    

#include <iostream>

#include <conio.h>

using namespace std;

class test
{
public:
	int i;
	test(){cout<<"ctor"<<endl;};
	~test(){cout<<"dtor"<<endl;};
};

int main(int argc, char *argv[ ], char *envp[ ] )
{
	test *t1 = new test();
	test *t2 = new test();
	cout<<"In the middle"<<endl;
	delete t1;
	delete t2;
	while(!kbhit());
	return 0;
}
    
Forever trusting who we are And nothing else matters - Metallica [edited by - Gabriel Fleseriu on May 3, 2002 6:12:53 PM]
Forever trusting who we areAnd nothing else matters - Metallica
Advertisement
Well, you can try this:

test *t1 = new test;

instead of:

test *t1 = new test();

If thispost = 0 Then
GoBack()

Else
Read()
End If
I'll have a link to the TriFaze website as soon as possible. It's still currently being designed, by myself of course! =) I'll update the URL and my signature as soon as possible.Feel free to send me a message on Yahoo! or AOL IM™. =)
Tried compiling it???
Works fine for me.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Errr..to all:

Yes, it compiles (c'mon, man!)
"new test;" instead of "new test();" gets me nothing.

VC++6.0SP5, W2k, STLPort.

[edit]got it (halfways): if I run from the ide (both F5 or Ctrl+F5) it doesn't work. If I run the exe, it works. God knows why

[edited by - Gabriel Fleseriu on May 3, 2002 6:28:18 PM]
Forever trusting who we areAnd nothing else matters - Metallica
Ok.. Just had to ask
It works ok for me too. Both VC++6.0 Sp5 and GCC 2.95.2, so I don''t know what could be wrong with it.. Just did some handy cut & paste job, and it compiled straight out of the (source)box..
quote:Original post by Rickmeister
Ok.. Just had to ask
It works ok for me too. Both VC++6.0 Sp5 and GCC 2.95.2, so I don''t know what could be wrong with it.. Just did some handy cut & paste job, and it compiled straight out of the (source)box..


That is (was... see the edit in the other post) my problem. If I cannot get that running, I probably have to kill myself !!!!!!!
Forever trusting who we areAnd nothing else matters - Metallica
quote:Original post by Gabriel Fleseriu
If I cannot get that running, I probably have to kill myself !!!!!!!


Maybe try reinstalling VC before you try a more permanent solution??

[edited by - Rickmeister on May 3, 2002 7:00:12 PM]
If you are useing MSVC, you might try creating a new project. If the project is a Win32 app or a dialog app, i don''t think they can print from COUT. You should make it a win32 console? app. don''t have my compiler in front of me.
maybe it''s closing the dos window before you''ve seen it.

i know you''re checking for a key press but try it by clicking the icon instead of pressing f5.

maybe a rebuild all

This topic is closed to new replies.

Advertisement