Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

This topic is 5912 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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 !!!!!!!

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!