|
You want to learn C?
Here is a great link that will teach you in a fun fashion:
Carl H Programming class
His Website
Also, check out Learn Programming Reddit
I'm learning to program, started out with Java, learned some C#, read some C, and now I'm learning C++.
Also, take a look at this Harvard Intro course:
CS50
There are other online sources such as MIT and Stanford free courses you could look at.
Also, many courses start with Java and Python.
Good luck!
|
|
I used command line utilities (like minGW with source + makefile in notepad) for 3 years of school. It's VERY overrated. It took me about 5 hours at my new job to get used to Visual Studio 2010, and now you couldn't rip me away from it if you tried. Knowing your compiler command-line executables is nice, but overwhelming for somebody just starting off. Visual Studio should take care of all that for you.
EDIT: Just in case you get frustrated at the beginning with VS, here are some instructions for the intro. (Sorry it's from memory so they won't be verbatim, but it will be close) File->New Project Choose a Command-line Visual C++ program and name it. On the right side, you should see a tree-like file structure. Open "Main.cpp"
Type:
#include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; }
Run it by clicking Debug->Start Debugging
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express
You should be able to download that and begin work immediately. The amazing thing about VS is that it's free (the express edition at least, and you don't need the full edition) and it's an incredibly common IDE so there are MANY examples online.
Also, you may consider starting with C# (C Sharp). I can't provide any firm reason for this, other than that it feels easier to use as you progress. C++ provides a more direct manipulation of pointers and memory locations though, so you'll probably learn more with C++ as a starter than C#. (This way you can transfer knowledge to other languages more conveniently)
If you're dead-set on minGW though, it looks like you may have forgotten to set up some system environment variables (the error messages you're getting are supremely unhelpful, but they're not pointing to any code errors.) Anyway, thats just my guess.
http://www.mingw.org/wiki/InstallationHOWTOforMinGW Check out this link for installing MinGW, specifically the line beginning "Create a directory (e.g. C:\MinGW), ", it tells you about environment variables
Happy hunting, don't give up yet
|
Snuggles, PM me and we can find a better way to communicate and I'll help you compile and run your first couple of programs.
A lot of people are suggesting stuff like visual studio and code blocks, but those are way too complicated to use. So is a command line compiler.
I can suggest a better IDE that's very beginner friendly. Also, your code has no pauses, so even IF you got your program to compile and link, running it would just cause you to see a quick "blink" ( unless you ran it through CMD )
In any case, PM me and I'll be glad to help.
P.S, you have no semicolon after your "return 0"... Try compiling this code instead:
+ Show Spoiler + #include <stdio.h> #include <stdlib.h>
int main (void) { printf("Programming is fun. \n"); system("pause"); return 0; }
|
On October 18 2011 12:16 ObliviousNA wrote: I used command line utilities (like minGW with source + makefile in notepad) for 3 years of school. It's VERY overrated. It took me about 5 hours at my new job to get used to Visual Studio 2010, and now you couldn't rip me away from it if you tried. Knowing your compiler command-line executables is nice, but overwhelming for somebody just starting off. Visual Studio should take care of all that for you.
I think you're more closely describing Windows as a development environment, not CLIs in general. In Windows your tools are so poor that IDEs are the *only* sane way to work. "Real hackers" (tm) live by their terminal.
My experience has been that IDEs help productivity in the short term (they ease domain-specific repetitive tasks), but they do not enrich your understanding of the underlying programs in the long run as thoroughly as doing everything "from scratch."
I've met more amateur Java programmers that didn't know how to use javac (let alone know what javac does) or configure a class path outside of Eclipse -- all they know is point and click.
|
Haha, I know BisuDagger, I went to school with him.
I like visual studio as my compiler but you may want to have someone who knows how to program to make sure it is set up correctly.
also if you're using visual studio and you got the drag and drop button options then you were not making a c++ program, it was probably a c# windows form, which is not going to probably compile that code.
Make sure when you make a new project that you choose the correct type of project. I don't know about other compilers but if you pick the wrong thing in Visual Studio it may not compile even though your code is correct.
If using visual studio you probably want to make a win32 console application (its a visual c++ template)
if you copy and paste this code into the main.cpp and it still doesn't work then you might have a problem not related to coding
#include <iostream> using namespace std;
int main (void) { cout<<"Hello World"; system("pause"); return 0; }
|
Op your post made me smile.
I studied computer sience and did all sorts of crazy stuff with more than a dozen different languages. The concern in your post is actually why I withdrew from pursuing a career as a programmer. Compilers can be bitchy, but it is just the beginning. Every language on every system, every reccource on every device ever created has it's own tweaks and twists. I actually think that the main principles of programming from variables to templates can be understood and used within a few weeks, the rest of the time it is focusing on the device specific implementation. If you aren't talented at figuring out stuff and spent endless time on grinding through dry as sandpaper and simply bad documentations written by generations of codemonkeys before you, it ain't a very fun thing to learn.
Still, having a programm run and do something amazing is just crazily rewarding. Thats the reason why I still programm from time to time, but just for fun and mostly with functional programming languages.
|
Programmers are born, not made. While you can learn some parts of programming, you need to have a certain mindset to really become good... and you can't learn that mindset from books.
However, if you want to try it, the easiest way to start is getting Visual C# Express from Microsoft ( http://www.microsoft.com/express ) and start clicking together a GUI and make it do simple stuff like "Fill a textbox with text when you press a button". Most of it is drag-and-drop, so it's quite simple. From there you can build simple applications or games like minesweeper. One Advantage is that C# is a language that is used a lot in the industry and some universities teach it, so you get a little headstart.
However, at some point in the future you will find that the drag-and-drop can't do what you want it to do, so you will have to resort to purely typing lots of stuff instead of using the mouse.
|
I've never used python so I can't speak for it, but I'd recommend against learning as your first language (and possibly becoming dependent on it) C#. Once you get familiar with your first language you might find it difficult to find the motivation to learn another one, and I'd hate to be in that situation if the first language was one you have to pay for (such as C#).
|
I think it's obvious that you actually do have what it takes to become a programmer since you haven't given up after this much trouble. Most people would probably give up after the first try.
|
I can't believe it you guys. I did it. I made my first program. Oh my f***ing god I really did it. After toiling over multitudes of different compilers and text editors, fiddling around with all sorts of cryptic commands- I finally compiled my first program.
Holy shit it's been a while since I've felt this good. Especially when things aren't going so well on the SC2 ladder, it's nice to have a breakthrough in something once in a while. I reinstalled my MinGW, set the correct path variables to get rid of the "libgcc_s_dw2-1.dll is missing" error, took Abductedonut's advice to put in "system ("pause");" into the code and voila- HELLO WORLD!
Thank you so much guys. I'll refer to the official TL Programming thread from now on with my problems. Now I can finally learn, YES.
|
On October 18 2011 23:00 BottleAbuser wrote: I've never used python so I can't speak for it, but I'd recommend against learning as your first language (and possibly becoming dependent on it) C#. Once you get familiar with your first language you might find it difficult to find the motivation to learn another one, and I'd hate to be in that situation if the first language was one you have to pay for (such as C#).
Uhm, you have to pay for programming in C#?
Microsoft is greedy but they know how to bind programmers to their platform... by providing lots of free stuff, like the excellent Visual C#/VB/C++/WebDeveloper Express IDEs, the free XNA framework, etc.
The only thing you would have to pay for are books, but not much difference to python there.
Actually, i can't remember a single programming language you have to pay for...
PS: This is coming from someone who was anti-Microsoft and anti-C#/.NET... until i had to write C# for one of my past jobs and learned that it's actually a great language and probably the first thing Microsoft ever did right.
|
Okay, I didn't know the IDE is free...
But it's true that you must have a windows box (or emulator) to run a C# program. And to have a windows box you must buy it. Or pirate it. No such restriction with C, C++, Python, Java, ...
|
On October 18 2011 11:02 kingjames01 wrote: First, you will need a compiler that will allow you to turn your programming syntax into something that the computer will understand.
Computer programs can be written in any text editor which you then pass into a compiler. However, since you are new at this, you'd probably have problems getting the compiling syntax correct.
Since you're working in C/C++, I would suggest that you download code::blocks. It is a FREE IDE that is specifically geared towards programming in C/C++.
What code::blocks will provide for you is an editor, a code/syntax highlighter, a compiling environment and a debugger all-in-one package.
After installing it, type in your source code, then compile it and finally run it all within code::blocks! Simple!
Let us know if you have more questions.
I cannot get code::blocks to work for the sake of my life, LOL. And I *KNOW* how to program.
|
On October 19 2011 10:02 BottleAbuser wrote: Okay, I didn't know the IDE is free...
But it's true that you must have a windows box (or emulator) to run a C# program. And to have a windows box you must buy it. Or pirate it. No such restriction with C, C++, Python, Java, ...
Well, the "big" IDE (Visual Studio Professional) with integrated unit testing, plugins and stuff costs money, but the small IDE (Visual C# Express) which is enough for 95% of the tasks is free.
Actually, Mono runs most C# programs perfectly fine on Linux and AFAIK mac as long as they don't use WinForms but GTK# or WPF instead, though i ran only console applications on linux myself since i don't do much GUI stuff.
Compile on Windows (or with the mono compiler on linux), copy exe to a linux box, type "mono foo.exe" and it runs.
I hate it if people blindly bash a language just because it's from Microsoft -.-
I dislike Microsoft as much as you if not more (i have experienced Windows 95, ME and Vista and have seen my fair share of Visual Basic code after all), but C# and .NET are perfectly fine. I programmed C, C++, Perl, PHP and Java for years and dabbled in a ton of other languages (ruby, python, scheme/lisp, tcl, ...). Sure, it's slower than C++ because it's a managed and garbage collected language but from my experience you can write programs in 1/10th of the time compared to C++, so if you want performance, C++ is definitely the language of choice, but these days i'm more of a "I don't want to bother with the details" guy who just wants results.
Just stay away from ASP.NET, THAT is an abomination :p
Anyways, enough language wars. The OP seems to use C++ which is imho not the best starting language but still a great language that i used for ages and where i fell into lots of pits.
Some hints: Operator overloading is nice but stay away from it, it's a dangerous minefield that will blow up your typing fingers if you don't have the experience to use it correctly (I'm speaking of experience here, i've done my fair share of unintentional operator overloading abuse and it all blew up. Now i have only one finger on each hand left :p)
Template programming and meta programming are great tools... to shoot into your own foot. Use templates, use defines but don't abuse them.
The RAII principle - http://en.wikipedia.org/wiki/RAII - is a good way to avoid some memory leak pitfalls when you are just starting with programming. Later you will discover cases where you don't want to use it, but until you are really experienced enough to know when not to, use it.
The Single Responsibility Principle - http://en.wikipedia.org/wiki/Single_responsibility_principle helps you with changing your code later. Don't use a "god class" that does everything and don't shy away from creating new classes just for small stuff if it doesn't fit into the responsibility of the current class.
The Law of Demeter - http://en.wikipedia.org/wiki/Law_of_Demeter - makes a lot of stuff easier later on. Get used to it early to avoid later pitfalls. Basically it says, don't do objectA.propertyA.do_something(); but instead objectA.do_something(); which internally just calls propertyA.do_something();
Also, follow Larry Walls "Virtues of a Programmer". http://en.wikipedia.org/wiki/Larry_Wall#Virtues_of_a_programmer
|
On October 18 2011 10:45 Snuggles wrote: So now I'm thinking to myself is this really what programming is? What's the point of getting a book that tells you to type everything out when a pre-existing program allows you to drag and drop everything?
Because a) somebody programmed this and didn't have a RAD-Environment b) you are very limited when it comes to actual functions and in-depth programming c) performance will always be an issue because these code generators simply don't allow to be very performance efficient, but this is only relevant when you need every bit of performance you can get, in other words not in the everyday usage.
To make it simple: Programming can be everything, from writing assembly code that requires lots of knowledge to drag&drop systems that are hardly real programming. You decide what you need and then you do it, though - it's all in your hands.
|
|
|
|
|