Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / **Sigh** Oh the joys of programming with C++.

Author
Message
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 3rd Dec 2012 21:46 Edited at: 4th Dec 2012 01:36
I have forgotten how programming in C++ can be a pain sometimes.
I spent the last two hours trying to figure out why my program doesn't work anymore.

Turns out that I forgot to include the braces around the last else block.
The compiler didn't even catch this mistake.



This little piece of code cause the agk functions to not register.
Functions like agk::GetPointerPressed(), agk::GetSpriteHit(), etc.


Don't mistake this for a complaint, just sharing, but I understand a little bit better why some people don't bother with C/C++ and program in basic.

Nevertheless, I continue the grind. Why? Because it's a love and hate relationship.
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 3rd Dec 2012 22:04
Which compiler are you using? Xcode won't let me do that.

Quote: "I understand a little bit better why some people don't bother with C/C++ and program in basic."

I've been burned by BASIC a few times (and C++ too) but C++ is growing on me. I like the referencing and OOP properties.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Dec 2012 23:24
I was able to do things with my (hopefully) soon to be published app that I never would have been able to if I hadn't converted it to Tier 2 (after getting sick of seemingly random errors caused by using strings).

I was able to create a nice level editor for the game and if/when I add more 'things' to it (future versions), it is relatively easy to add new game_obj_<something> as derived objects based on game_obj_base which handles all the common, core initialization from file bits, and other stuff.

I much prefer C++ over basic. But, then I've been programming for a long time.

Cheers,
Ancient Lady
AGK Community Tester
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 3rd Dec 2012 23:31
Quote: "Which compiler are you using? Xcode won't let me do that. "


I'm using VS2008.

@Ancient Lady

I like C++ too, especially the opportunities that come with it.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Dec 2012 23:39
Yup, std::string is one of the good ones. Then you have std::list and its friends.

And I love making functions/classes that do all the string formatting bits for me.

Cheers,
Ancient Lady
AGK Community Tester
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 4th Dec 2012 00:52
Take the semicolon out after the {} second braces and try it!

You've got a single line comment-out inside a brace pair. Not good!

Just a thought.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 4th Dec 2012 01:44
Quote: "
Take the semicolon out after the {} second braces and try it!

You've got a single line comment-out inside a brace pair. Not good!

Just a thought.
"


Yeah, Yeah. You right. So I've fix the post above.
What happen was instead of copying and pasting, I've typed up a quick example when posting.
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 4th Dec 2012 03:30
Quote: "Yup, std::string is one of the good ones. Then you have std::list and its friends.

And I love making functions/classes that do all the string formatting bits for me."

Boost is also really good for the more complex projects, as well as allowing some really cool string parsing functionality through Boost::Lexical_Cast and Boost::Tokenizer.

Quote: "I'm using VS2008."

When I was using VS2008 myself(back in my DGDK days), I had lots of issues with the compiler and even more issues with the linker. VS2010 fixed a lot of those issues for me(well, that and the fact that I actually know what I'm doing this time around).

XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 4th Dec 2012 06:58
I went to C++ and I haven't looked back. Without C++ you don't get the nifty things like Vectors which allow you to do fancy Arrays.
I'm getting the hang of them and they are pretty powerful for handling a lot of tasks.
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 4th Dec 2012 07:56
I to am starting to like C++ to, i got so tired of the T1 compiler. I would prefer to use a diffirent IDE though. Something about VS2010 just bugs me

Login to post a reply

Server time is: 2024-11-24 03:56:08
Your offset time is: 2024-11-24 03:56:08