Well, you seem to have simply copy/pasted a few lines of code out of the working tutorial code.
Your main issue right now seems to be to read errors properly.
The filename. You pasted a few lines from a function, which had parameter as a function argument. Obviously that argument is not here, so you have to declare filename yourself above the location where you access it. The compiler simply doesn't know what "filename" is (Hint: In the tutorial code it's a std::string)
apply_surface is the same. It's a function defined in the tutorial code. You only copied lines calling that function. The compiler obviously does not know the function.
Simple solution: Copy also the apply_surface function and paste it above the main function.
Thankyou for your reply!
Have gotten the code to compile without error, however when I run the program, the exe window pops up for about 1 split second and then disappears instantly. Despite it being advised against, I've tried using system pause to keep it from disappearing but to no avail. Is there something wrong with how I'm setting the project up perhaps?
I've noticed this happens for a few of the tutorials on the site, but not all. The play sound/display images tutorials have worked fine.
I've been trying to follow tutorials for a good week now, but I'm finding myself frustrated at the fact that, when someone provides a tutorial code and basically says "just throw this in your compiler and run it", it can't just be entered into any C++ compiler. I'm finding myself lost with the fact that one has to go and, (if I've got this right), hunt down random libraries, headers etc, or compile their own. I guess that's one thing that programming in the QBASIC environment never taught me, and is one of my shortfalls in making the jump to C++. You could take code from anywhere and slap it in, compile it and run it, but as far as C++ goes, I feel like I'm going way too slow.
This is one of the many, many reasons that we don't recommend C++ as an early language. The number of pitfalls is ridiculous - a language like C#, Java or Python insulates you from most of this type of concern.
More relevantly, perhaps: start small. Work your way up from "Hello, World!", learning all the basics along the way - source/header files, makefiles, static versus dynamic linking. C++ isn't the language to use if you want to go off half-baked.
Well, I've been reading through a book (C++ For Dummies. I also have Accelerated C++ and C++ The Complete Reference for later), although I'm learning how to code without any major issues, it's a matter of compiler compliance. (ie the tutorials in my book, oddly enough, use printf instead of cout, despite being a c++ book). Problem is, if I try tutorials online, I end up on the same problem; tutorials written by a group of different people, with vague areas such as "oh if you need this header, just make one yourself" etc. You need to already be able to professionally code, in order to learn to code it seems.
What I would love is to be able to pay for a digital tutor of sorts, someone I could ask questions to etc. The downfalls of tutorials are that they sadly, do not talk back whereas a tutor would be infinitely useful, especially one who has been involved in some form of either games programming or game engine programming (I'm curious and keen to try out both at some point). I've done Java and C in college, but it didn't really help me learn about how to tackle C++, especially game-related aspects, then again, my games development teacher consisted of a guy whos only programming experience consisted of a DOS style interface for a bank that he built.
I will take myself back a few steps though, I'm going to give myself at least 3 years max to try and get a basic Raycaster out there. If 7 year old youtube kiddies with ADD can do it, I don't see why I shouldn't be able to. I'll look up some tutorials on headers, makefiles, and linking, as it sounds like the kind of thing that has me a bit stumped at the moment. Thanks for your response by the way!
I've been trying to follow tutorials for a good week now, but I'm finding myself frustrated at the fact that, when someone provides a tutorial code and basically says "just throw this in your compiler and run it", it can't just be entered into any C++ compiler. I'm finding myself lost with the fact that one has to go and, (if I've got this right), hunt down random libraries, headers etc, or compile their own. I guess that's one thing that programming in the QBASIC environment never taught me, and is one of my shortfalls in making the jump to C++. You could take code from anywhere and slap it in, compile it and run it, but as far as C++ goes, I feel like I'm going way too slow. When I was doing my games programming diploma at TAFE, they never even bothered to cover anything past making a simple real time strategy in C, never taught us how to make headers, or utilize custom libraries.
At the moment for example, I'm following Lode V's Raycasting tutorial -> http://lodev.org/cgtutor/raycasting.html and Codeblocks with the GNU C++ compiler. I would love to know what I need to be able to do to take the code he's provided and compile it successfully, have it spit out a .EXE I can run.
However, I'm finding that even after popping the appropriate libraries into their respective directories, (the SDL referred to in his tutorials) I'm running into compiler-killing errors. So I guess my next question is, given that there's no striaghtforward tutorial to setting up up library X with compiler Z, what would you guys recommend I use? Should I abandon codeblocks for another compiler and set of libraries that seem to be the standard? Every tutorial I find seems to always branch off into different directions and this is the one thing that tended to lose me; some will say to use Visual Studio, others will say use DevC++, etc, but often the codes don't seem to be interchangeable.
I would search before posting again, but I'm not quite sure what terms one would search for in regards to my question, but then again, I'm posting because I'm really keen, I really do want to learn, and I don't care how long it takes. I've spent the last week also touching up and studying maths furiously, have torn through a considerable amount of Khan Academy videos and begun quizzing myself, and making simple C++ programs to try and push what I've learnt as I guess this would be a good way to learn, by experimenting.
I know my posts are dead long, but anyone who has the time to respond, it would be mega appreciated, and when the day comes that I become an evil Russian billionaire, I'll happily pay the favor back however you like.
If you really want to do it from zero, then it will be rather a long journey than a simple "project". If you have plenty of time and motivation then you`ll have nice results in 2-3 years(depending on how good you are at maths/3D maths.)
-You not just have to learn C++ ...but OOP prorgramming itself, lots of maths, 3D maths, physics, directX / openGL, (a sound API and networking ...optionally) etc.
If you dont wanna create your own 3D models ....just import them from an other program ...thats saves a lot of time.
-It makes more sense to build up your engine incrementally and create actual games along the way, ....cause you can spend months with working on things that make your engine more solid but dont add anything to the graphics. .....it can be quite demotivating.
-And you need to have 2D projects too. ....with many things its better to have a good understanding of them in 2D before doing the dimension jump:)
....anyway Wolf 3D and Doom1 are not really 3D games, but 2D games with 3D(ish) graphics.
Sounds like an ideal plan, and yeah I'd begin with simple 2d engines, games etc at first, learn how it all slots together etc. I guess I wouldn't expect to be able to make a Wolf3d clone for a few years yet, but it's my goal. I dream of being able to make just some kind of generic 3d fps engine, even if it was never good enough to be sold or used commercially, just something to toy with and use to learn, but it's one of the things that's on the cards for the next decade of my life, or optimistically, 5 years.
As for 3d models, I should be able to build most of them myself, I've done a level design, 3d modeling and 3d animation before. I've done a bucketload of mod work over the last 10 years in Doom/2, Build engine, Source Engine and Unreal. Have also built a lot of special effects, so it would be fun to play around with some of these aspects from the coding side of things once I get the hang of it.
2-3 years sounds good, nothing good comes easy or fast, it just relieves me to know that it's not some 10 year endeavour, I don't want to end up making something half decent by the time my life is already more than halfway over.
Still, thanks for all the answers guys! I know I haven't replied to all of them but I've read all your responses.