Jump to content
  • Advertisement
Sign in to follow this  
CelticSir

Problem with script (no errors but no output?)

This topic is 2476 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

Hey

I been learning C++ for about 2 days now and for the most part it was going fine i made a blackjack game and some puzzle game. So i then tried a basic 2D role playing type thing.

Course now for some reason, it all goes wrongs tongue.png I get no output on my screen but i equally got no errors displayed when i ran the script. I was hoping some one could run my script and see if it outputs for you ...

My script is here:

http://www.paste.to/MzQ0MzMz[/quote]

I'm currently using C++ console. So its very basic stuff.

I'm hoping some one can spot the mistake I'm sure its something obvious but my eyes must have been staring at it for so long i simply cannot see where the issue lies.

Thanks for you're time in advance.

Share this post


Link to post
Share on other sites
Advertisement

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in class cDungeon. At line 52 in the constructor you define a variable named aaMaze even though at line 73 you define a data member with the same name. This wouldn't normally be a problem but in this case you try to use both in the constructor and so you're really only using the one you defined at line 52. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png. Edited by Smacker_626

Share this post


Link to post
Share on other sites

I get no output on my screen but i equally got no errors displayed when i ran the script.


Your compiler will be generating error messages. If you're using a development environment such as Visual Studio, XCode, Code::Blocks, KDevelop, etc, there will be a window that you can show which will display the build errors (or a triaged interpretation of them).

Share this post


Link to post
Share on other sites

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in cDungeon. The constructor uses a local variable named aaMaze but there's a data member called aaMaze as well. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png.


You've lost me on number 2... can't see where you're referring to =/

EDIT: Ah i see - it works now :)

Share this post


Link to post
Share on other sites

[quote name='Smacker_626' timestamp='1330759191' post='4918800']

  1. At the beginning of the file, include "cstdlib" so that you can access rand() and srand().
  2. You have a name conflict in cDungeon. The constructor uses a local variable named aaMaze but there's a data member called aaMaze as well. Fix the name conflict.

Do these 2 things and your code works fine.

Hope that helps smile.png.


You've lost me on number 2... can't see where you're referring to =/

EDIT: Ah i see - it works now smile.png
[/quote]
Sorry I wasn't very clear, I've edited my post to be a bit clearer.

Glad to help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!