Author |
Message |
Kameboy
|
Posted: Sat Feb 19, 2011 4:18 pm Post subject: How to get started in C++? |
|
|
First of all i learnt Turing and Java a bit using the holt software. But i wanted to learn C++ and learn how to create games using that programming Language. I was also wonder what is a good IDE or editor to download. Also i was wonder what do you thing would be a good. The last thing i was wonder what plugins or extension do you need to download to create graphics and use audio in C++. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
DemonWasp
|
Posted: Sat Feb 19, 2011 4:57 pm Post subject: RE:How to get started in C++? |
|
|
There are a few schools of thought on C++.
The first school is the more UNIX-y way of doing things. You download a compiler and toolkit, such as g++, make and gdb, and then you edit with vim or emacs. You compile from the command line. Everything is easier to do right because your tools are very simple and modular and direct to use.
If you're on Windows, download MinGW and gVim and get cracking. If you're on Linux, download g++, gdb, make, vim: sudo apt-get install g++ gdb make vim or similar.
The second school is the more Windows-like way. You download an IDE, which comes with its own compiler. You compile by pressing a button. Everything is easier to do right because your tools will instantly help you out, as much as they can.
If you're on Windows, download Microsoft Visual C++ IDE or Borland's latest IDE, or whichever other company you happen to like. |
|
|
|
|
|
Kameboy
|
Posted: Sat Feb 19, 2011 5:10 pm Post subject: Re: How to get started in C++? |
|
|
If i went the second way what IDE is eaiest to use and user friendly. Also how would you create graphics and audio using C++. I learnt a few of the basic code from a teacher at my school for text but how would i go a little farther than that. |
|
|
|
|
|
Insectoid
|
Posted: Sat Feb 19, 2011 6:33 pm Post subject: RE:How to get started in C++? |
|
|
C++ doesn't have built-in graphics support afaik, however you can interface with OpenGL and SDL for this. |
|
|
|
|
|
Kameboy
|
Posted: Sat Feb 19, 2011 8:38 pm Post subject: Re: How to get started in C++? |
|
|
I heard of them when doing some research and do they support audio and how do i install them properly to my computer i tried but not sure if i did it right. |
|
|
|
|
|
Insectoid
|
Posted: Sat Feb 19, 2011 10:54 pm Post subject: RE:How to get started in C++? |
|
|
SDL has audio support. |
|
|
|
|
|
CodeMonkey2000
|
Posted: Sun Feb 20, 2011 3:36 pm Post subject: RE:How to get started in C++? |
|
|
Forgot about graphics and audio for a while. First thing you need is a compiler. DemonWasp already pointed out the different approaches to this.
Picking which one is up to you. The UNIX-y approach is much harder, requires lots of googling, but you understand what is happening when you write code, and compile it. It will be tedious for newbs. Ultimately you get a deep understanding of what's going in using this approach.
The windows approach is much easier. If you just want to start making programs with no fuss, this is the way to go. But when you are reading tutorials on how to compile, a lot of the times it will feel like black magic on how to compile.
In either approach, if you want to do anything with graphics/audio, you need to decide on what API to use. SDL is a good one, so is GTKmm. I now use Qt though. But before you even touch graphics, you need to be somewhat competent in C++, know about pointers, objects, and the fancy features like the STL.
When I started, I started in C and SDL using code::blocks on windows. This is probably a good place to start (only with visual studio instead of code::blocks). SDL is a purely C API, it'll be less confusing starting here. |
|
|
|
|
|
Tony
|
Posted: Sun Feb 20, 2011 4:08 pm Post subject: RE:How to get started in C++? |
|
|
Well as the saying goes: GUI (here discussed as "the windows approach") makes trivial tasks easy, and non-trivial tasks impossible to do (where's the button to link to files in an external directory while using some specific optimization flag?).
The tradeoff, of course, is that there are no "do magic" buttons on command line. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Sponsor Sponsor
|
|
|
Kameboy
|
Posted: Sun Feb 20, 2011 4:21 pm Post subject: Re: How to get started in C++? |
|
|
So what your saying is to download codeblocks and SDL and learn C++ from the ground up and learn how about the differents libraries and what they would bring to the program. Also your saying to learn about who the code complies and what each code would do before i go to learning how to create sophisticated graphics start with the easy and make my way up. |
|
|
|
|
|
Insectoid
|
Posted: Sun Feb 20, 2011 5:11 pm Post subject: RE:How to get started in C++? |
|
|
That sounds like the way you should learn just about everything. |
|
|
|
|
|
Kameboy
|
Posted: Sun Feb 20, 2011 8:01 pm Post subject: Re: How to get started in C++? |
|
|
How do i get the SDL library set up every time i try running the test programs they won't run |
|
|
|
|
|
Tony
|
Posted: Sun Feb 20, 2011 8:09 pm Post subject: RE:How to get started in C++? |
|
|
Read the documentation. Follow all the steps carefully. Figure out what the error messages are. This is all a part of a learning process. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Kameboy
|
Posted: Sun Feb 20, 2011 9:08 pm Post subject: Re: How to get started in C++? |
|
|
I followed the setups i figure out how to fix most of them but i still get 12 error codes
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x7)||undefined reference to ` _SDL_Quit'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x29)||undefined reference to `_SDL_GetModState'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x161)||undefined reference to '_SDL_GetKeyName'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x265)||undefined reference to `_SDL_Init'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x26e)||undefined reference to `_SDL_GetError'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x33a)||undefined reference to ` _SDL_SetVideoMode'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x343)||undefined reference to ' _SDL_GetError'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x377)||undefined reference to ` _SDL_EnableUNICODE'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x38b)||undefined reference to `_SDL_EnableKeyRepeat'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x3a3)||undefined reference to ` _SDL_WaitEvent'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x40a)||undefined reference to ` _SDL_Quit'|
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingw32.a(main.o):main.c: (.text+0x104)||undefined reference to `_WinMain@16'| |
|
|
|
|
|
CodeMonkey2000
|
Posted: Mon Feb 21, 2011 6:34 pm Post subject: Re: How to get started in C++? |
|
|
Kameboy @ Sun Feb 20, 2011 4:21 pm wrote: So what your saying is to download codeblocks and SDL and learn C++ from the ground up and learn how about the differents libraries and what they would bring to the program. Also your saying to learn about who the code complies and what each code would do before i go to learning how to create sophisticated graphics start with the easy and make my way up.
I said visual studio, and C instead of C++ lol.
Kameboy @ Sun Feb 20, 2011 4:21 pm wrote: I followed the setups i figure out how to fix most of them but i still get 12 error codes
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x7)||undefined reference to ` _SDL_Quit'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x29)||undefined reference to `_SDL_GetModState'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x161)||undefined reference to '_SDL_GetKeyName'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x265)||undefined reference to `_SDL_Init'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x26e)||undefined reference to `_SDL_GetError'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x33a)||undefined reference to ` _SDL_SetVideoMode'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x343)||undefined reference to ' _SDL_GetError'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x377)||undefined reference to ` _SDL_EnableUNICODE'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x38b)||undefined reference to `_SDL_EnableKeyRepeat'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x3a3)||undefined reference to ` _SDL_WaitEvent'|
C:\Users\Siva\Downloads\SDL-devel-1.2.14-mingw32\SDL-1.2.14\test\checkkeys.o:checkkeys.c: (.text+0x40a)||undefined reference to ` _SDL_Quit'|
C:\Program Files\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\libmingw32.a(main.o):main.c: (.text+0x104)||undefined reference to `_WinMain@16'|
You didn't link correctly to the .lib files. |
|
|
|
|
|
Xupicor
|
Posted: Tue Feb 22, 2011 5:31 pm Post subject: RE:How to get started in C++? |
|
|
If he used MinGW then that would be .a files, but otherwise it sure looks like he forgot to link properly.
The IDE you're using probably has a Project Properties page, and Linker/Consolidator Options in it - you should add the needed library there. |
|
|
|
|
|
|