Moving from Java to c++

Started by
20 comments, last by Saruman 11 years, 5 months ago
I recently decided to start learning a second language now that I'm quite comfortable with Java. I'm just looking for a few opinions on which ide to use, what I'm looking for is something that's free, or 'free,' that is well documented/used in a lot of tutorials.

I feel like the ide will have a bigger impact when learning c++ than it did when I was learning Java as I'll be using features other than the text editor much more often(correct me if I'm wrong), so I'm looking for something that is widely used and therefore easier to google anything I might need to find out about it.

I'm familiar with eclipse using Java, I'm not sure how good it is for c++ I know it's an option though. Just from googling around I see a lot of people who love VS but also a small subset of people who absolutely hate it. Also I don't know how hard it'd be to get without spending hundreds of dollars/how good the express edition is.

What would you recommend for someone who wants to learn c++ and eventually use it for much more complex programming?

for the record; I love intellisense, and I'm using windows 7 on a reasonably fast computer


EDIT:
this is my reply I posted further down, I just wanted to include it here so more people see it because I'd like to get some more feedback on it but it doesn't really warrant a new thread.

Thanks for all the great replies everyone! I think I'm going with Visual studio 2012 express(is there any reason that I might use 2010 instead?). I tried a few tutorials already just using visual c++ express cause apparently I already had it, but it always got build errors. just from simple hello world programs. I'm assuming It's something to do with my setup because i tried several tutorials copying the code exactly and they all got the same error. even the default hello world program errored. hopefully I wont have that issue in VS

I would recommend not using an IDE at first, actually. Using a toolchain of separate tools (initially this can be just text editor and compiler, with build control, memory analyzer, static analyzer, debugger added into the mix later one by one) lets you learn faster what is going on. Also, while you have a small amount of code, like just a couple of thousand or ten thousand lines, I don't see an IDE actually doing anything for you over separate tools.

Hmmm. that actually sounds like a good idea, my main goal here is to learn everything thoroughly and properly from the beginning so I can be a good c++ programmer soon. I think forcing myself to do that will help me learn things that I'd usually just happily ignore and let my IDE do it for me. How important and how hard is learning all that? Anyone else think this is a good idea?
Also while I'm here, should I start with c++ 11? I know nothing about the different versions, is it backwards compatible? is it or will it be the standard soon? which version do you recommend I start with and why? The only concern I might have about that is that its new and might not be as well documented, I love have a wealth of resources when learning something new and complicated like c++.
Anyone have any other general suggestions for learning resources or tips? I wanna learn this as thoroughly and as well as possible but I'm also eager to get my hands dirty with some real programming as soon as I can
Advertisement
Visual Studio is the industry standard. It is an assumed knowledge; game developers don't list "visual studio" for the same reason they don't list "Windows" as a technology they know.

The free Visual C++ Express Edition is only missing only a few features you probably won't miss.

Learn it, embrace it, because like it or not you will be using it during your career.

I'm just looking for a few opinions on which ide to use, what I'm looking for is something that's free, or 'free,' that is well documented/used in a lot of tutorials.

The most popular free IDEs for C++ are probably, in no particular order, Visual C++ Express, Code::Blocks and Qt Creator.


I feel like the ide will have a bigger impact when learning c++ than it did when I was learning Java
[/quote]
Perhaps. For Java, an IDE as pretty-much mandatory though, as the build process is difficult to manage without one. In C++, it's doable (though non-trivial) without using an IDE.

I'm familiar with eclipse using Java, I'm not sure how good it is for c++ I know it's an option though.[/quote]
I only tried the Eclipse CDT plugin ~5 years ago. It was awful then (too slow to be useful), but it might have improved by now. You could of course take a look at a recent version if you're sufficiently attached to eclipse.

Just from googling around I see a lot of people who love VS but also a small subset of people who absolutely hate it.[/quote]
I'm one of the people that hate it (though I like the Visual C++ toolchain). Vim has spoilt me.

Also I don't know how hard it'd be to get without spending hundreds of dollars/how good the express edition is.[/quote]
The express edition is probably fine. It certainly won't hurt for starters.

I will say though, that regardless of the IDE you pick, it's absolutely essential, IMHO, that you get to grips with the C++ compilation model early on. Once you understand this, you'll be able to fix your own problems easily, regardless of which IDE you pick.
The new vs2012 express is VERY GOOD. Also Eclipse CDT is pretty good, actually the most feature complete IDE in existence, however can be a bitch to setup and get working. And can be slow.

QT Creator is the best cross platform IDE in existence.

VS2012 is the best windows IDE with QTCreator the close second.

Code::blocks is ok but lacks many features, such as real syntax highlighting, and hasn't been update for 2 years.

If this post or signature was helpful and/or constructive please give rep.

// C++ Video tutorials

http://www.youtube.com/watch?v=Wo60USYV9Ik

// Easy to learn 2D Game Library c++

SFML2.2 Download http://www.sfml-dev.org/download.php

SFML2.2 Tutorials http://www.sfml-dev.org/tutorials/2.2/

// Excellent 2d physics library Box2D

http://box2d.org/about/

// SFML 2 book

http://www.amazon.com/gp/product/1849696845/ref=as_li_ss_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=1849696845&linkCode=as2&tag=gamer2creator-20


What would you recommend for someone who wants to learn c++ and eventually use it for much more complex programming?
I would recommend not using an IDE at first, actually. Using a toolchain of separate tools (initially this can be just text editor and compiler, with build control, memory analyzer, static analyzer, debugger added into the mix later one by one) lets you learn faster what is going on. Also, while you have a small amount of code, like just a couple of thousand or ten thousand lines, I don't see an IDE actually doing anything for you over separate tools.
Brace yourself for the horrors of memory management. That is all.
However in all seriousness, some pointers:

1) C++ Is Unforgiving. Your code's errors can be extremely weird.
Example:
I had my Breakout game. In debug mode everything worked fine, however in release mode whenever the cursor crossed a certain Y position on the screen the game would just close. I eventually found out that I had an undefined Boolean value that I was referencing in a Class. The bug was annoying because it was working fine on my machine, which made pinpointing the error extremely annoying. And of course, the IDE in debug mode didn't give me the error (Or even a warning message).

2) Memory Management Tips
First Tip: Delete dynamically allocated memory as soon as possible. Whenever you do, set the pointer to null.
Also, try to use the new operator as little as possible. Using auto-pointers is fine, and you generally don't need the normal new and delete operators.

Also, I use Visual Studio, however there are many good IDE's. The debugger in Visual Studio is amazing.
I've used Code::Blocks. It doesn't have precompiled headers and the library support is good, however a lot of the auto-linking libraries don't work (SFML 1.6, as of now, doesn't work correctly).

It really doesn't matter which IDE you use. Just try them all out and see which one you like.

I'm a game programmer and computer science ninja !

Here's my 2D RPG-Ish Platformer Programmed in Python + Pygame, with a Custom Level Editor and Rendering System!

Here's my Custom IDE / Debugger Programmed in Pure Python and Designed from the Ground Up for Programming Education!

Want to ask about Python, Flask, wxPython, Pygame, C++, HTML5, CSS3, Javascript, jQuery, C++, Vimscript, SFML 1.6 / 2.0, or anything else? Recruiting for a game development team and need a passionate programmer? Just want to talk about programming? Email me here:

hobohm.business@gmail.com

or Personal-Message me on here !


And of course, the IDE in debug mode didn't give me the error (Or even a warning message).

The reason is because it is not a warning or error to the language. Also this is a big reason that you should use initializer lists in all constructors to initialize the class members, or in the rare case that you don't (say in a vector4 or matrix44) you need to be careful never to use it until it has been assigned a value. Note the reason it works fine in debug mode is that values will be initialized whereas in release mode they are not.


First Tip: Delete dynamically allocated memory as soon as possible. Whenever you do, set the pointer to null.

I disagree with both. It is actually much better to reuse dynamically allocated memory at runtime than to delete and reacquire. I would only delete when it is no longer needed. Although this is really a non-issue if you are using C++11 due to having std::unique_ptr, std::shared_ptr, and std::weak_ptr.

Regarding setting the pointer to null after deletion this is something I absolutely disagree with and is just inviting bugs to linger in your codebase. By setting to null you won't catch any double delete errors, etc which would be found and handled easily by attempted to delete something that has already been deallocated.

Regarding setting the pointer to null after deletion this is something I absolutely disagree with and is just inviting bugs to linger in your codebase. By setting to null you won't catch any double delete errors, etc which would be found and handled easily by attempted to delete something that has already been deallocated.


This is something that is important in C so many C programmers carry this habit over to C++.
As you're coming from eclipse i would recommend Code::Blocks and Netbeans. Eclipse CDT is ok,
but I don't like it's gdb integration. It doesn't keep the hook properly, and that makes threading even more of a pain.
Both Netbeans and Code::Blocks are fairly lightweight. VS is great too, but for small projects like mine, VS just seems too heavy.
Thanks for all the great replies everyone! I think I'm going with Visual studio 2012 express(is there any reason that I might use 2010 instead?). I tried a few tutorials already just using visual c++ express cause apparently I already had it, but it always got build errors. just from simple hello world programs. I'm assuming It's something to do with my setup because i tried several tutorials copying the code exactly and they all got the same error. even the default hello world program errored. hopefully I wont have that issue in VS


I would recommend not using an IDE at first, actually. Using a toolchain of separate tools (initially this can be just text editor and compiler, with build control, memory analyzer, static analyzer, debugger added into the mix later one by one) lets you learn faster what is going on. Also, while you have a small amount of code, like just a couple of thousand or ten thousand lines, I don't see an IDE actually doing anything for you over separate tools.


Hmmm. that actually sounds like a good idea, my main goal here is to learn everything thoroughly and properly from the beginning so I can be a good c++ programmer soon. I think forcing myself to do that will help me learn things that I'd usually just happily ignore and let my IDE do it for me. How important and how hard is learning all that? Anyone else think this is a good idea?

Also while I'm here, should I start with c++ 11? I know nothing about the different versions, is it backwards compatible? is it or will it be the standard soon? which version do you recommend I start with and why? The only concern I might have about that is that its new and might not be as well documented, I love have a wealth of resources when learning something new and complicated like c++.

Anyone have any other general suggestions for learning resources or tips? I wanna learn this as thoroughly and as well as possible but I'm also eager to get my hands dirty with some real programming as soon as I can

This topic is closed to new replies.

Advertisement