Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3

Author Topic: Starting out in C++  (Read 4112 times)

Eduan

  • Bay Watcher
  • A genius born genius
    • View Profile
    • EduanTech
Starting out in C++
« on: August 15, 2012, 10:50:11 am »

Hello everyone, my name is Eduan, I'm the new guy in the town. :P

I was wondering some things cause I'm just starting out in C++, which really interests me.

I am a web developer, not very good but decent, I already have my IDE and everything, I code in PHP, JavaScript, XHTML and some C++. I use EditPad Pro and JetBrains' PHPStorm, those are the editors I use, in case you need an idea of my level.

Now, my questions is, what do you guys/gals recommend for someone that's just starting out? I am no longer a newbie in programming so advanced IDEs are OK.

So what are your recommendations on the following?:
  • IDE, not Eclipse please, doesn't have to be free.
  • Developer community, not that I doubt this forum or anything, I know this place has excellent programmers, just want a community purely made of developers, know what I mean?
  • Compiler, always wanted to learn C++ but never found a good compiler.
  • Reference website that's complete, easy and to the point, take php.net as reference. If possible, that it's also for C, so that I can learn C at the same time. ;)
  • Some simple projects for me to start with.

Don't need a tutorial as I already have some books and lynda.com.

Also, any recommendations on graphics? I hear OpenGl and LWJGL are good, I don't need 3D graphics, only 2D, and it doesn't matter if it's a tileset for my first projects.

Thanks for any insight you can offer. :)
« Last Edit: August 15, 2012, 11:00:30 am by Eduan »
Logged

Repulsion

  • Bay Watcher
    • View Profile
Re: Starting out in C++
« Reply #1 on: August 15, 2012, 11:26:03 am »

I probably can't help you a whole lot but here is some helpful images about C++. There's also a bunch of other images to do with other languages and whatnot. And the site itself has, well, a CRAPTON of stuff in it.
Logged
Electrum, pedophilia, and necrophilia at the same time!?

Normandy

  • Bay Watcher
    • View Profile
Re: Starting out in C++
« Reply #2 on: August 15, 2012, 12:57:58 pm »

IDE:
Hrmmm, but I like Eclipse! Any particular reason you don't want to use it?

Anyways, what OS are you using? I can only speak for Windows, but my favorite IDEs are Eclipse and Microsoft Visual Studio. VS Express is free, and if you're working alone, you probably won't need any of the features of the paid versions (alternatively, if you're a student with a .edu address, you can get the pro versions for free off Dreamspark). Eclipse is also a solid IDE that integrates well with C++.

Code::Blocks is another choice but I always saw it as Eclipse with less polish, so I never really used it much.

Avoid Dev-C++ at all costs. It's objectively terrible.

There are also a few other IDEs out there but they aren't as common so they might not be so good for first-timers.

If you're not used to statically typed languages or using a compiler, I would suggest you stick to an IDE until you're more comfortable with the language.

Developer community:
Just use stackoverflow and #C++ on freenode IRC or something. Anywhere is fine, really.

Compiler:
You pretty much have two options: GNU Compiler Collection (gcc) or the MSVC Compiler (built into VS). There are other compilers out there but these two are the most common, and so most libraries will have precompiled binaries for these two compilers only.

g++ (the gcc C++ compiler) is standard on most *nix systems, and is a good compiler. gdb is the debugger for g++, and it does a good job of it. Most open-source IDEs will come bundled with these two tools.

MSVC is windows specific, and is bundled with VS. The debugger built into VS is also extremely good.

I'm not sure why you said you couldn't find a good compiler, what precisely is a good compiler to you? C++ has some weird compiler idiosyncrasies, and given your stated language experience, I'm fairly sure you've never had to deal with a beast as strange as the C++ linker (C++ is a fun language where you can compile the same code twice and get different results!). But it's a part of the language. Once you get more used to C++ syntax it would be educational to write a few simple multi-file programs in a plaintext editor then try compiling them by hand to learn how the compilation and linking steps work in C++.

Reference Website:
One thing that's important to know about C++ is that it's neither a simple nor a small language. It's a huge sprawling mess. You won't find any complete reference that's both simple and complete. I learned C++ quite a while ago so I don't remember precisely what websites I used to frequent. Looking through my bookmarks I guess these two links would probably be the most useful:

http://www.parashift.com/c++-faq-lite/index.html C++ FAQ Lite
http://www.icce.rug.nl/documents/cplusplus/cplusplus.html C++ Annotations

Simple Projects:
If you already know how to program, but you're interested in C++, what you really need are C/C++ specific puzzles. I don't have a good resource for that, but things like arrays being pointers (but not really), references being true references (but actually pointers (but not really)), how to properly use the const keyword (and learning how to parse const char * const *), operator overloading (and why the standard library is really clever), scoping (and why you actually have to worry about it (and why C++'s scoping is really dumb sometimes (and why you need C++11 (but also why C++11 makes the language even more unmanageably large...)))), memory fun time (why "delete this;" makes sense and the great feeling you get when you get your first segfault), the C preprocessor (and why you shouldn't touch it with a 10 foot pole (but why you should know how to use it)), OOP from before the last decade, the list goes on...
Logged

Eduan

  • Bay Watcher
  • A genius born genius
    • View Profile
    • EduanTech
Re: Starting out in C++
« Reply #3 on: August 15, 2012, 01:19:49 pm »

Thanks for your detailed answer! So here are my answers:
I probably can't help you a whole lot but here is some helpful images about C++. There's also a bunch of other images to do with other languages and whatnot. And the site itself has, well, a CRAPTON of stuff in it.
Thanks! I'll check it out later. Gonna figure some things out first, so that I can concentrate on the code once I see it. What do you mean with images btw?

IDE:
Hrmmm, but I like Eclipse! Any particular reason you don't want to use it?

Anyways, what OS are you using? I can only speak for Windows, but my favorite IDEs are Eclipse and Microsoft Visual Studio. VS Express is free, and if you're working alone, you probably won't need any of the features of the paid versions (alternatively, if you're a student with a .edu address, you can get the pro versions for free off Dreamspark). Eclipse is also a solid IDE that integrates well with C++.

Code::Blocks is another choice but I always saw it as Eclipse with less polish, so I never really used it much.

Avoid Dev-C++ at all costs. It's objectively terrible.

There are also a few other IDEs out there but they aren't as common so they might not be so good for first-timers.

If you're not used to statically typed languages or using a compiler, I would suggest you stick to an IDE until you're more comfortable with the language.
I don't like Eclipse, because if I remember correctly, last time I tried it it was kinda slow (my computer isn't a gaming computer and it's almost 5 years old  :o ) and because I believe it installed the Babylon toolbar in my system, which is considered a virus, and it's horrible! And because I don't really like it's interface, it's probably customizable but I'm too lazy to do that. :P When you say "statically typed languages" you mean "strongly typed languages" correct?

I don't like Visual Studio because first of all, it's made by Microsoft for Windows, and I'm a Microsoft hater (even though I use a Windows XP), second of all, I know Microsoft's software, and I bet you anything it's gonna be slow in this computer.

I have used Code::Blocks in the past, but it didn't even startup in my computer so that's a dead-end. lol

I believe I once used Dev-C++, but it outdated by a couple of C++ versions I believe, so that's a no can do anyway.

If I can't find any good IDE for me, then I can use EditPad Pro, it's compatible with C++ anyhow.

Developer community:
Just use stackoverflow and #C++ on freenode IRC or something. Anywhere is fine, really.
I already use StackOverFlow, just wanted to see if there are any other options, I don't really like freenode IRC so...

Compiler:
You pretty much have two options: GNU Compiler Collection (gcc) or the MSVC Compiler (built into VS). There are other compilers out there but these two are the most common, and so most libraries will have precompiled binaries for these two compilers only.

g++ (the gcc C++ compiler) is standard on most *nix systems, and is a good compiler. gdb is the debugger for g++, and it does a good job of it. Most open-source IDEs will come bundled with these two tools.

MSVC is windows specific, and is bundled with VS. The debugger built into VS is also extremely good.

I'm not sure why you said you couldn't find a good compiler, what precisely is a good compiler to you? C++ has some weird compiler idiosyncrasies, and given your stated language experience, I'm fairly sure you've never had to deal with a beast as strange as the C++ linker (C++ is a fun language where you can compile the same code twice and get different results!). But it's a part of the language. Once you get more used to C++ syntax it would be educational to write a few simple multi-file programs in a plaintext editor then try compiling them by hand to learn how the compilation and linking steps work in C++.
I believe I tried the GNU Compiler Collection, but I couldn't find any clear instructions on how to use it. :/

For me a good compiler is the one that runs C++ code the fastest and less variable possible.

I haven't worked with C++ so yeah, I haven't had the variable results you mention, although I have heard of it and seen it.

Reference Website:
One thing that's important to know about C++ is that it's neither a simple nor a small language. It's a huge sprawling mess. You won't find any complete reference that's both simple and complete. I learned C++ quite a while ago so I don't remember precisely what websites I used to frequent. Looking through my bookmarks I guess these two links would probably be the most useful:

http://www.parashift.com/c++-faq-lite/index.html C++ FAQ Lite
http://www.icce.rug.nl/documents/cplusplus/cplusplus.html C++ Annotations
Thanks! I'll be sure to check them out. :) isn't there like a book or something like that that's official? In other words, the ultimate resource for C++ you could say?

Simple Projects:
If you already know how to program, but you're interested in C++, what you really need are C/C++ specific puzzles. I don't have a good resource for that, but things like arrays being pointers (but not really), references being true references (but actually pointers (but not really)), how to properly use the const keyword (and learning how to parse const char * const *), operator overloading (and why the standard library is really clever), scoping (and why you actually have to worry about it (and why C++'s scoping is really dumb sometimes (and why you need C++11 (but also why C++11 makes the language even more unmanageably large...)))), memory fun time (why "delete this;" makes sense and the great feeling you get when you get your first segfault), the C preprocessor (and why you shouldn't touch it with a 10 foot pole (but why you should know how to use it)), OOP from before the last decade, the list goes on...
Not sure I understand any of that, lol. I meant like small projects that can get you used to the language, I mean things like the classic games or other things that can get you aquainted with C++ and game development.

Thanks again, and I wait for your answer. :)

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: Starting out in C++
« Reply #4 on: August 15, 2012, 01:39:22 pm »

Code::Lite is another C++ IDE that has a lot of modern features (And C++11 support) you could try.

At the end of the day, programming on old computers will always be a pain in the arse because the technology has advanced to take advantage of newer hardware. Visual Studio and Eclipse are slow on old computers largely due to the advanced autocomplete and refactoring features they can provide, with the additional handicap of these things being more performance intensive in a language like C++ which is more difficult to parse than say Java or C#.

Not that Java and C# don't have their own quirks and weird stuff, especially in the "deeper" and more obscure or older parts of the languages...
« Last Edit: August 15, 2012, 01:52:07 pm by MorleyDev »
Logged

Eduan

  • Bay Watcher
  • A genius born genius
    • View Profile
    • EduanTech
Re: Starting out in C++
« Reply #5 on: August 15, 2012, 01:52:06 pm »

Code::Lite is another C++ IDE that has a lot of modern features (And C++11 support) you could try.

At the end of the day, programming on old computers will always be a pain in the arse because the technology has advanced to take advantage of newer hardware. Visual Studio and Eclipse are slow on old computers largely due to the advanced autocomplete and refactoring features they can provide, which are always more performance intensive in a language like C++ which is more difficult to parse than say Java or C#.

Not that Java and C# don't have their own quirks and weird stuff, especially in the "deeper" and more obscure or older parts of the languages...
Thanks! I'll definitely check it out!

Yes I see what you mean, well PHPStorm works perfectly well and pretty fast, even on this computer, on the startup is kinda slow, the thing is it's only got 2.0 GHz processor power, and integrated Intel graphics card. Other than that it's quite decent.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: Starting out in C++
« Reply #6 on: August 15, 2012, 01:57:40 pm »

Yeeeah, PHP is...look, you don't want to hear my opinions on PHP. Read this article. It lists all of PHPs failings so I don't have to :D

I mostly use C# and a little SQL at work but the companies clients can and will use the web-based REST API (which the team I'm on develop) in a whole myriad other languages. I've had to help the support team every now and again with cases where people have used that horrible language in horrible ways which has combined with a dislike of the horrible syntax and horrible lack of sensible conventions (which encourages the aforementioned horrible usages) of that language to form unbridled hatred.

Refactoring or maintaining tools seem to be near useless (or no one who uses PHP seems to care about such trivial things as 'refactoring' or 'code quality') with PHP anyway so are going to be lightweight and unneeded. Unless you're dealing with a powerhouse language like C# with ASP.NET (or a bloated mess like Dreamweaver), the tools available for website development are going to be infinitely simpler than for other languages.
« Last Edit: August 15, 2012, 07:04:08 pm by MorleyDev »
Logged

Normandy

  • Bay Watcher
    • View Profile
Re: Starting out in C++
« Reply #7 on: August 15, 2012, 02:02:48 pm »

When you say "statically typed languages" you mean "strongly typed languages" correct?
My bad. Static typing and strong typing are two separate things, but C++ is both strongly typed (i.e. you cannot add a string and an integer together without a cast) and statically typed (i.e. a variable that is defined to be a string will always remain a string). Both are important concepts.

Quote
I don't like Eclipse, because if I remember correctly, last time I tried it it was kinda slow (my computer isn't a gaming computer and it's almost 5 years old)

I don't like Visual Studio because first of all, it's made by Microsoft for Windows, and I'm a Microsoft hater (even though I use a Windows XP), second of all, I know Microsoft's software, and I bet you anything it's gonna be slow in this computer.

The main slowdown was probably because Eclipse automatically compiles your program every time you save (though this was a couple of versions ago, I haven't programmed in C++ for a while). There's an option in one of the menus that turns this option off, which makes Eclipse run a lot faster.

And also, you're missing out. Visual Studio is an absolute delight to work in. Although yeah, from what you say, the newer versions may run a bit slowly.

Quote
I believe I tried the GNU Compiler Collection, but I couldn't find any clear instructions on how to use it. :/

For me a good compiler is the one that runs C++ code the fastest and less variable possible.
Yeah, that's one issue with learning C++ without an IDE. The IDE normally handles all the compiling for you. If you want to do it by hand you need to be familiar with the command line and how the C++ compilation process works. I don't remember where I learned how to do that though... Also, modern C++ compilers are good. You don't need to be worrying about them not following C++ spec or not being fast or anything like that.

Quote
Thanks! I'll be sure to check them out. :) isn't there like a book or something like that that's official? In other words, the ultimate resource for C++ you could say?

There's always the C++ spec, but it's useless for learning C++, trust me. C++ is just too big and too messy of a language for you to learn anything useful from the spec. My advice is to learn about language features slowly as you need them (and hopefully you won't ever need all of them).

Quote
Not sure I understand any of that, lol. I meant like small projects that can get you used to the language, I mean things like the classic games or other things that can get you aquainted with C++ and game development.

IMO Javascript is a much more interesting place to be learning about game development nowadays. Sure a lot of big modern blockbusters are built in C++, but there are growing markets in the industry for mobile and social games which leverage interesting gameplay mechanics rather than processor-intensive AAA-title type stuff. Open standards regarding Javascript and related HTML5 technologies are poised to possibly become a huge platform for game development in the next couple of years. That's my two cents for learning C++ to make games. (Edit: As in, don't learn C++ to make games.)

However, learning C/C++ is definitely useful considering how much stuff is written in it, so I won't say that you shouldn't do it. If you're dead-set on learning game programming through C++ though, I would recommend starting off using SDL (2d graphics library) and following the tutorials at http://lazyfoo.net/. They're extremely basic, and the coder doesn't always have the best coding practices (and SDL very much a C library rather than a C++ library, so it won't teach you good OOP), but I remember them as being very good introduction to graphics and game programming. Once you have more experience, you can then move up to 3d stuff and other game libraries/engines.

Quote
Thanks again, and I wait for your answer. :)
No problem!
« Last Edit: August 15, 2012, 02:05:13 pm by Normandy »
Logged

Eduan

  • Bay Watcher
  • A genius born genius
    • View Profile
    • EduanTech
Re: Starting out in C++
« Reply #8 on: August 15, 2012, 02:10:22 pm »

Thanks again Normandy! I'll be sure to check out Eclipse and Visual Basic then, I'll post any questions I have if you don't mind. ;)

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: Starting out in C++
« Reply #9 on: August 15, 2012, 02:16:57 pm »

Here's an interesting presentation on Agile Development in C++ with Eclipse.
http://www.youtube.com/watch?v=ZIOjwyRML9s

I'm a recent convert to Agile Development and Test Driven Development after where I work knocked me out and brainwashed me showed me how flexible and effective they are as a methodology.

Eclipse and Visual Basic

I assume this is a typo xD
« Last Edit: August 15, 2012, 02:26:19 pm by MorleyDev »
Logged

Eduan

  • Bay Watcher
  • A genius born genius
    • View Profile
    • EduanTech
Re: Starting out in C++
« Reply #10 on: August 15, 2012, 03:01:02 pm »

Here's an interesting presentation on Agile Development in C++ with Eclipse.
http://www.youtube.com/watch?v=ZIOjwyRML9s

I'm a recent convert to Agile Development and Test Driven Development after where I work knocked me out and brainwashed me showed me how flexible and effective they are as a methodology.
Thanks! I'll be sure to check it out.

I assume this is a typo xD
Indeed it is. :P
« Last Edit: August 15, 2012, 08:08:26 pm by Eduan »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: Starting out in C++
« Reply #11 on: August 15, 2012, 10:22:36 pm »

I'm a recent convert to Agile Development and Test Driven Development after where I work knocked me out and brainwashed me showed me how flexible and effective they are as a methodology.
Oh dear D:


Personally, Visual Studio actually works for me. I think the devs did a good job on it. Of course, I'm no professional developer, so don't ask me for a reliable review.

I don't like Eclipse, just because. >.> The ever-changing GUI is way too customizible (Not a word, I know D:) for me. I hated it while trying to use it for Java, and I thereafter don't like it.

I heard that one problem with C++ is that the specs don't define "how to do certain stuff", so the machine code from one compiler/IDE probably will be different from another compiler's; especially compared to C. This is hearsay, though, so again don't take my word for it.

Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

GalenEvil

  • Bay Watcher
    • View Profile
    • Mac-Man Games
Re: Starting out in C++
« Reply #12 on: August 16, 2012, 12:16:26 am »

I have used Dev-C++ (horrible horrible thing to use; for some reason had to use it in a college C-Programming class) and Visual Studio C++. I like VS-C++ for the most part. It is pretty easy to use, and even on my badly out of date laptop (1.5GHz dual core w/ 2GB RAM) it speeds along quite nicely.
Logged
Fun is Fun......Done is Done... or is that Done is !!FUN!!?
Quote from: Mr Frog
Digging's a lot like surgery, see -- you grab the sharp thing and then drive the sharp end of the sharp thing in as hard as you can and then stuff goes flying and then stuff falls out and then there's a big hole and you're done. I kinda wish there was more screaming, but rocks don't hurt so I guess it can't be helped.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: Starting out in C++
« Reply #13 on: August 16, 2012, 04:42:21 am »

Visual Studio is a fantastic IDE, and the debugger is awesome. In 2010 onwards you can even integrate other compilers (other languages, platforms, or just other compilers for windows) directly into it. It runs well on old hardware too, I've got it on my eeepc, and it runs well.

The compiler's support for the newer C++ standards is a bit lacking, however. GCC (MinGW on Windows) is much better for that.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Randos

  • Bay Watcher
  • The Earth Strikes You!
    • View Profile
    • Comic Wolf
Re: Starting out in C++
« Reply #14 on: August 16, 2012, 05:45:11 am »

Hi, I'm new too.

I use Linux and this year I have started coding a game with C++ too.  I am using the C++ SDL library for graphics which is pretty easy to use, it also has a pretty good history and seems to have a big following which makes it stable, it is cross platform so you can make programs that run on different operating systems, and it supports 2D, 3D and all types of keyboard, mouse, joystick, sound, etc, etc, etc.

I have heard raves about Visual Studio, even from people who don't like using Windows, apparently it is a very well done software.

I personally try to stay as far away from IDE's as I can.  I just like good editors with hot keys and syntax highlighting.  The less time my hands have to move to the mouse the better.

Vim is a good editor, also Emacs, but I'm not sure if this is the type of thing that everyone can get used to.  It takes a little time to learn them, but after you do your coding speed will definitely increase and you'll find it a lot more comfortable.

Logged
Pages: [1] 2 3