Easygoing Eyebeast keira Posted May 19, 2009 Posted May 19, 2009 Because I'm attempting to make another attempt at learning C++. I know PHP (somewhat) which I hear is kind of like C, but whenever I look at source code, it might as well be in Japanese. Any suggestions on how to go after it? Also: I have Dev-cpp 4.9.9.2 installed, but whenever I try to compile the BoE source code (no modifications) it stops and gives me some funky errors. I've tried screwing with the settings some, but to no avail... Quote
Rotghroth Rhapsody Chokboyz Posted May 20, 2009 Posted May 20, 2009 Originally Posted By: w-dueck Also: I have Dev-cpp 4.9.9.2 installed, but whenever I try to compile the BoE source code (no modifications) it stops and gives me some funky errors. I've tried screwing with the settings some, but to no avail... What source code are you trying to compile ? If it's the official one (i.e the version 3 that is on Spidweb site), then good luck : the code is full of outdated types and somewhat adapted functions (from Mac to Win32) ... Add to that, that the code is intended for 16-bit platform ... If i may suggest, you should better get the last copy of Ormus' build as it is a much cleaner version of the code (note that it introduces at least one bug in the save file function, though) ... Or you could wait for the current code to be stable enough for a release (the only significant thing that is left is the Empty bug ... any recipe to make them appear ? ). Originally Posted By: w-dueck Any suggestions on how to go after it? I would recommend starting with plain C before going to C++. Familiarize yourself with types (char, int, arrays ...), flow controls (if... then ... else ... ; switch case ...; and so on), functions (arguments; return values ; declaration vs definition ; learn what a header file is, if you don't know already), standard functions, pointers (that is important), structures, ... Then you will be able to begin learning C++ with much more chances of success (the main difference between C and C++ is that C++ is object-oriented; search what classes are to begin) ... There's a lot of sites that gives useful advices for beginner in C. If you ever have access to your college's library, you will undoubtly find a good book on C/C++ in there. Then again, i'm not the specialist here (Celtic Minstrel for instance seems more knowledgable about C++ and may help you better with this). Ah, and if you comes from PHP, you have to declare a variable in C/C++ Hope it helps, Chokboyz Quote
Easygoing Eyebeast The Mystic Posted May 20, 2009 Posted May 20, 2009 Originally Posted By: Chokboyz There's a lot of sites that gives useful advices for beginner in C. If you ever have access to your college's library, you will undoubtly find a good book on C/C++ in there. Could you please list a few sites? I've been trying to find a good starting point for almost a month, and I'm stumped, despite having previously dabbled a little in Pascal, VB6, and COBOL. I've at least found a programming environment, called Code::Blocks. Quote
Understated Ur-Drakon Celtic Minstrel Posted May 20, 2009 Posted May 20, 2009 ...Are you holding back a release just because the Empty bug is still not fixed? Just add some checks to make sure that monster number 0 is never spawned. I think it's high time the Windows code got into the repository. It doesn't need to be perfect. Putting it in the repository is not the same as making a release. Anyway. C and C++ are similar enough that if you know C it should be easy to learn C++, and vice versa, but I actually don't recommend learning C first. The two languages may be very similar, but the added features of C++ mean that a good C++ program will look very different than a good C program. For example, C functions often return an error code; in C++, it's usually better to throw an exception (unless you know they're unavailable on your target platform, which isn't the case for Windows and Mac). That allows the function to return its actual result rather than an error code. I learned it in high school, actually, but I already had experience programming in other, less portable languages (Logo, actually! And Hypertalk.) If you're familiar with AvernumScript, then you already have some idea of the syntax. AvernumScript is modelled more on C than C++ though. Regardless, the basic syntax is the same: for example, statements end with a semicolon. The things Chokboyz said you should familiarize yourself with are very good. I'd add some C++ features to that. I'll include his stuff on the list too, for completeness. types (char, int, arrays ...) conditionals (if... then ... else ... ; switch case ... default...) loops (for loop, while vs do...while) functions (arguments; return values ; declaration vs definition ; learn what a header file is, if you don't know already) standard library functions (math functions, printf, scanf) pointers structures and classes (public vs protected vs private members, virtual functions, public vs protected vs private inheritance, virtual inheritance, stuff like that) exception handling (try...catch blocks, the throw statement) the streams library (cout and cin, fstream, sstream) STL containers (especially string and vector) arrays references Most C++ tutorials will introduce you to cout and cin immediately – they're the core of a console-based C++ application. However, they're useless in BoE – we use other, similar streams instead (that is, when we use streams at all). I'm sure you could find a C++ tutorial on Google, and I'd be happy to answer any questions you may have. Quote
Well-Actually War Trall Niemand Posted May 20, 2009 Posted May 20, 2009 cplusplus.com is pretty useful as websites go; I refer to it constantly for details of the standard library. There are also many good books; the one I have and have found pretty solid is Object-Oriented Programming in C++. I would second the recommendation that you not waste your time learning C; it's only use as far as I'm concerned is for embedded system programming where a fancier compiler and larger libraries aren't available. Spending time on it would be a little like learning the unicycle before starting with a bicycle; related, but often not very usefully. (This analogy is a little off in that a unicycle is probably more difficult whereas C is not really more difficult or easier, just different.) CM points out most of the highlights in his post, so I'll elaborate upon a few of them. The STL is good, and you should seek to learn about it as soon as possible; many courses and books I've seen will waste a student's time on other more C-like methods which then get thrown away. Also, don't shy away from pointers; they are tough to begin with as they seem to require developing a specific mindset, at least for me. However, once you understand them they are a very powerful tool. Books will often try to protect students from pointers on the grounds that they are dangerous, but this just means that the student has a worse time when pointers have to be dealt with and he isn't prepared. They certainly aren't for use in every situation, but a good programmer should be fully aware of them. If you're coming from a scripting language, like PHP, it's good to keep in mind that types are a big deal in C++, and with good reason. They can be very important for thinking easily and correctly about how your program will work. The rigorous type system isn't there to get in your way or encumber you, it's to help you know what you're doing. With regard to my own learning: C++ was the first computer language I really learned, although I had previously tinkered on my own with TI-BASIC. I deliberately worked over one summer to get up to speed so I could take AP Computer Science in high School the last year that it was taught with C++ rather than Java, which has proven to have been a pretty useful decision. I used Java for a couple of years due to taking an introductory course in Computer Science in college, and after that it took me a little while to get back to being comfortable with C++, but having tried both I now wouldn't waste the time starting a new project using Java without a rather good reason. Quote
Easygoing Eyebeast ben4808 Posted May 20, 2009 Posted May 20, 2009 http://ecx.images-amazon.com/images/I/51n0eVq1e6L._SS500_.jpg Quote
Understated Ur-Drakon Celtic Minstrel Posted May 20, 2009 Posted May 20, 2009 Don't you think it'd be more useful to link the the page rather than the image? Quote
Easygoing Eyebeast ben4808 Posted May 22, 2009 Posted May 22, 2009 Yes I do. First I tried posting the image right in the post like the good ol' days, but then I remembered that hotlinking was disabled. And I'd already closed the browser window I got it from and didn't feel like finding the page url again. Basically its cuz im lazy. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.