Jump to content
  • Advertisement
Sign in to follow this  
highowl

Dev-C++ reading comments as code - HELP

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

Okay first off, I know there are many of you who dislike Dev-C++ but please keep your comments regarding that to yourself. Here's my problem.... I've started writing code for a game....I have a working version but I'm re-writing the thing to clean-up the code. I've restructured the comments to be more friendly on the eyes but now it seems to pick up some of the comments as code. Here is the beginning of my 'main.cpp'
 //STANDARD INCLUDES\\
//===================\\


 //ALLEGRO INCLUDES\\
//==================\\
#include <allegro.h>  //Allegro 4.2
#include <jpgalleg.h>  //Allegro JPG support.
#include <alfont.h>  //Allegro custom font support.


 //CUSTOM INCLUDES\\
//=================\\
#include "mainmenu.h"
//#include "loadgamemenu.h"
//#include "newgame.h"


 //EXTERNAL DECLARATIONS\\
//=======================\\
            //ALLEGRO\\
           //=========\\
           extern BITMAP *screenbuffer;  //Declare a screen buffer to draw to.
           extern BITMAP *imageadd;      //Declares a BITMAP for blitting to the buffer.
           extern ALFONT_FONT *customfont;  //Declaration for custom fonts.   
           
            //GAME\\
           //======\\
                /*
                  game_state states
                  =================
                  0 = main menu (no game in progress)
                  1 = new game
                  2 = load game menu
                  3 = loaded game
                  4 = options
                  5 = quit game
                  6 = main menu (game in progress)
                */
                extern int game_state = 0;  //^ See above ^


int main()
{




The commented portion that reads "game_state states" is being read as a comment....though I'm not sure why....its inbetween /* and */ . If I add "//" before "game_state states" it comes up with an error for the "==============" line. Right now the error its giving me is "'game_state' does not name a type" But it shouldn't even be parsing that as code. The editor even shows it as an off blue....which is the color set for comments. So I'm completely baffled as to why it's acting like this.....that's right....I said baffled. Anyways, any help would be greatly appreciated....as I can't test my re-write until this bullsh*t is solved and I'd like to keep the comments structured atleast similarly....I just don't know why it's acting like this. EDIT: My bad, I tried code tags but it didn't work and I couldnt find a list of tags for the gamedev forums....This should show up the way my code is actually structured. [Edited by - ApochPiQ on October 14, 2009 5:23:08 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try putting your pasted code in [ source] ... [/ source] tags... the way it currently is, it looks like the /* before the game_states line isn't being read because it's within a // comment, so you could fix it by doing this

// blah
/*
game_states
*/

instead of

// blah /*
game_states
*/

But it's likely that that's not how your code is _actually_ structured.

So yeah. Source tags.

Share this post


Link to post
Share on other sites
Quote:
Original post by highowl
Okay first off, I know there are many of you who dislike Dev-C++ but please keep your comments regarding that to yourself.
Why? The unsuitableness of Dev-C++ for programming in 2009 is not a matter of opinion.

Share this post


Link to post
Share on other sites
Here's a friendly piece of advice: your excessive commenting will waste lots of your time. Look around for some articles and hints about writing "good" comments. It is a common beginner's mistake to think that the more comments you write, the better. Comments are a last resort to which you turn when your intention cannot be clearly expressed in code through descriptive naming and clear layout. Comments like "//Declare a screen buffer to draw to." are redundant because it simply restates what anyone with basic C/C++ skills would understand from reading your code.

Quote:
Original post by Codeka
Why? The unsuitableness of Dev-C++ for programming in 2009 is not a matter of opinion.


Agreed. But it's hardly our problem, is it? He asked us not to comment on his use of Dev-C++. Let him use it if he wants to. :)

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!