Advertisement

Where can a beginner learn about the C++ compiler and Visual Studio 2015 (I want to use SDL)

Started by November 08, 2015 02:38 AM
4 comments, last by Anri 9 years, 1 month ago

I'm new.

I would like to learn C++ and to use an extensible language like Lua together for game development. But the first thing I need to do is really understand my environment and the compiler.

I would like to use SDL for some simple graphics so I can practice some simple programming in C++ and then move on from there. However, I'm having a devil of a time understanding how the compiler works and how to install and use SDL in Visual Studio 2015 so I can include its libraries and start coding. Setting up the environment and this cMake thing is just a bit over my head at the moment.

What I could use is some direction / a good book / tutorials / a tutor (I can dream) in understanding how this works so I can understand my compiler, what cMake does and how the Visual Studio 2015 IDE is used to set up something like SDL for use on a Windows 7 (soon to be 10) machine.

In other languages I have dabbled with (like Python and C#) installing a framework was usually done for me. I'd be given an executable, or I'd just run a simple pip command, and everything would be ready to go. Then I just do some kind of include statement for the libraries I want to use and off to the races I went.

But with C++ and SDL it's more complicated -- more low level -- and I really don't understand all of it so when things don't just work I'm not sure how to troubleshoot. There seem to be many different compilers for C++ with a lot of differences and well....it's just a massive and mature language with 80 ways of doing the same thing, and while I don't mind learning, I really need a more productive way of educating myself. Out of all the programming languages I have looked into, C++ seems the most complicated one to get an overview of since it's just so massive and there are so many different ways of using it. I'm not sure that came out the right way.

Thanks for reading my post and any time you spend responding.

I will start off by saying good luck with this... I consider myself fairly experienced and I just did this myself (after a little break from programming). That is, installing VS2015, getting SDL to make a window, getting opengl to draw stuff along with a few other things and I must say it was a TOTAL NIGHTMARE. The reason for this is that very very few of the things I wanted are/were built for VS2015 which means you have to build them yourself but then they require other things that are also not built.. and then you try to use those things but they use other things that won't build.. Originally I planned to use Ogre3D but I gave up on that for similar reasons.

I found this very frustrating but in the end I did get it going. Once you have it going it's fine but getting it going especially if you are inexperienced (I am experienced coding but not so much getting everything up and running initially) is difficult.

For starters, SDL https://buildbot.libsdl.org/sdl-builds/sdl-visualstudio/?C=M;O=D Now I don't entirely understand all these numbers and I lost my link that explained it but the version I have which works is

sdl-visualstudio-2560.zip 2015-10-01 18:29

642K

Download that. Extract it somewhere. Open VS and on right click on your project and go to properties c/c++/Additional Includes and add that directory e.g. "SDL\sdl-visualstudio-2560\SDL\include".

Then go to linker/General/Additional library directories and add that, something like this: "SDL\sdl-visualstudio-2560\SDL\lib\win32".

Then go to linker/Input/Additional dependancies and add SDL2.lib;SDL2main.lib

Then.. from where you put SDL to begin with find SDL2.dll and copy it into the runtime directory of your project, it'll be something like Documents\Visual Studio 2015\Projects\<Project Name>\Debug

Hopefully you can then follow a tutorial to get a window to show. I was using OpenGL so I used this:

https://open.gl/context#SDL

I hope this helps you out slightly. If you do follow the above tutorial I think I might have also had issues with GLEW too...

I am not sure but in case it helps the version I am using that I know works with VS2015 is glew-1.13.0.

I should also add I am using Win10 but I don't recall having to do anything specific to Win10.

I hope that provides you with a little guidance, I'm afraid I can't be of more help as I found it quite difficult myself.

If you do lack experience I would avoid all of this. Get something working with a console then maybe just use windows specific code to get a window going rather than SDL.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

Advertisement
My post is probably not going to be very informative or useful. but I really hate the setup process of SDL. Its goddamn hard. This is why I don't use it (and because of the old D3DSDK dependency).

I agree SDL wouldn't have been easy for me to install if I'd have to do it by myself. I was quite lucky to find these tutorials which helps a lot in my opinion. He does not cover cMake though.

Could you elaborate on what you mean by 'understanding the compiler'? It seems a rather broad question/topic to me.

On a side-note, the mentioned c++ tutorials go over game-oriented basics of c++ including challenges in which he shows how to make text based games (and later on including rendering with OpenGL/SDL too). Even though you already appear to have some significant programming experience, taking a look into a few of these may help your understanding of c++ and his challenges provide a good exercises if you ask me. There's definitely stuff that you will already know, but it's easy to skip over such videos. Again, this has helped me and doesn't necessarily work as well for everyone out there, but you can give it a shot.

Of course the guide provided by Nanoha is a good start as well, same for the advice he gave: do something with the console instead if you feel it's a bit too much. Text-based games are fun to make too!

Google leading me to MSDN webpages has been a great help to me in regard to visual studio. Do you know enough to know what to search for or have enough experience with VS to know what to ask? Or do you need something from the ground up?

-potential energy is easily made kinetic-

If you want a beginners introduction to SDL 1.2(and a transition chapter for 2.0) then I recommend "The Black Art of Multiplatform Game Programming" by Jazon Yamamoto. Its not a big book but it sure does cover the important things like setting up SDL with Code::Blocks for Windows and Eclipse for Linux. Compared to a behemoth like Andre Lamothe's "Tricks" books, this one is refreshingly light and covers the topics a complete beginner are looking for, whilst being a quick-start guide for those of us who are familiar with game programming.

Its worth learning how to write simple C/C++ programs in notepad and then compiling through the command line to avoid a nasty future of header/library linking errors. GNU Make is a bit of mystery at first, but the first chapter of the GNU Make manual explains it well. Once you understand how to compile and link programs without an IDE then you can use such programs with confidence.

You can get by with Code::Blocks and Jazon's book, but do set aside time to learn the basics of compiling and linking.

Best of luck!

Languages; C, Java. Platforms: Android, Oculus Go, ZX Spectrum, Megadrive.

Website: Mega-Gen Garage

This topic is closed to new replies.

Advertisement