Author Options:

How Do I begin to program in c without a microcontroller Answered

How would i get started writing programs in C/C++ on the computer for free. I would like to be able to write simple games.



9 years ago

Well, microsoft has their Free Visual C++ Express Edition

Borland (now "codegear"?) Has an older version of their compiler available for free as well.

And there are Many others

If your interest is mostly game making, rather than C/C++, there are also things like GameMaker and of course a wide variety of Basic and Java development environments.

(you might want to note that programming games in a windows environment is MUCH different than programming anything on a microcontroller.)

Well, the vast majority of a windows game would be setting up the graphical display and interface. But since you don't WANT that, there's quite a bit LESS of a difference.

For non-gui, text games running in a CMD window, your best bet might be the gnu C compiler running under cygwin, or mingw, or even gcw. There are probably others out there too, but a LOT of the easy-to-use windows packages are very focused on allowing the users to write windows-like GUI applications, rather than the non-gui stuff you're interested in (for instance, if you LIKE the arduino environment, there is "Processing", which is like an Arduino Grandparent.)

I want to start off slow to learn the code. If i wanted to be a programmer which would you recommend?

I dunno. I haven't been a beginner programmer in a long time, and I don't program much under windows, and things were a lot different back then. The whole idea of skipping the "visual" programming may be a bad idea, because that's where a lot of the "educational tools" are aimed. I don't know that there has EVER been an educational track aimed specifically at "embedded programming", or even "systems programming" - Apps have always been king, even when the "apps" were hard-core numeric processing. OTOH, most of the principles of programming can be learned either way... Pick something and dive in...

What exactly is visual programming? For apps what would i use?

In this case, I just mean things with a Graphical User Interface; windows and menus and stuff, as opposed to a text "Command Line Interface" that you interact with using only a keyboard. I think the "visual" programming aspect comes into play when you're writing the program - visual basic lets you set up what your program window is going to look like by dragging and dropping in assorted GUI elements (menus, buttons, sliders, etc.) It's quite possible to create GUI programs without a visual programming language (The Arduino environment looks like a good example), but it's pretty painful. OTOH, WITH the visual programming, you can set up the basic window and GUI pretty easilly ("visually") and concentrate on the actual program logic (if there IS any :-)

oh I thought that visual programming was like the Lego mindstorms, where you had to drag boxes that represented lines of code. Is microsoft visual c any Good? The game aspect looks good.

I dunno; I don't often write windows programs (hardly ever.) I used microsoft visual basic to write the app in this instructable, and found it pretty nice. And gamemake is quite good. My attempt to use visual C was not so successful, but I think thta was mostly me bouncing off my C preconceptions from other environments.

What is different? Also Is there any c compiler in ubuntu?

Almost all the linux distributions include (or can include) the Gnu C compiler.

Is this a visual c compiler. Is it a full suite where you can write programs and run them naively?

There are a lot of GUI-building tools in Linux. Some, like KDevelop and Glade, come close to a Visual C type environment. Others are simple IDE interfaces like you might find with an other Borland-style environment.

Generally Linux dev tools aren't as tightly integrated as Microsoft. Some people consider that a strength. There's much more flexibility in the Linux approach. It's far easier, IMO, to write and compile a simple cmdline program in Linux than in the Visual Programming Suite (which is the "official" MS Windows development product.)

But the MS products can be more comfortable for beginners.

Linux gives you multiple choices for the windowing toolkit Qt (used in KDE) and GDK (used in Gnome), as well the plain-jane default X Windows TK, and many others (Motif, etc.) Some of the Linux TKs are cross-platform, and can be used to compile MS Windows versions of the same program...

Are most c compiliers use the same codes. So any book on c will be helpful?

Yes, all C looks the same and uses the same basic language constructs. However, my observation is that writing a program for a modern GUI operating system involves an awful lot of understanding which particular "libraries" need to be used to perform which functions in a OS-compatible way. So that, for instance, porting an app from linux to macos has very little to do with actual differences in the C compiler, and a lot to do with finding a "carbon version of the GTK2+extra library."

If i only wanted to run my programs on linux would i have a problem? so, a program written in one compilier be used in another. And aren't libraries different codewords do do different things?

I think you need to jump in somewhere and get started, after which you'll be able to ask better questions...

when i say games i mean ones that can be played in command prompt style like a tic tac toe game. I use arduino to try to create games now but i am still an armature. Pretty much all i can do is use some leds and pulse them. I tried to make tic tac toe but for some reason the program didn't work right.

I failed to mention i do not want anything visual. I want something comprible to what programmers use.

I use dev-C++ by bloodsoft it's great

I highly reccommend game maker. A good place to start is the Game maker wiki. I'm Adrian monk there, too, so feel free to contact me on either site for help.