Question

I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either:

  • learn the ins and out of C in Visual Studio
  • recommend a better C IDE + compiler

Edit: See also: https://stackoverflow.com/questions/951516/a-good-c-ide

Was it helpful?

Solution

Answering the purely subject question "recommend me a better C IDE and compiler" I find Ming32w and Code::blocks (now with combined installer) very useful on windows but YMMV as you are obviously used to the MS IDE and are just struggling with C.

May I suggest you concentrate on console applications to get a feel for the language first before you attempt to tie it together with a windows UI which in my experience is the hardest bit of windows development.

OTHER TIPS

well you can use visual studio just fine take a look at here man http://www.daniweb.com/forums/thread16256.html

Go to View Menu select Solution Explorer or CTRL+ ALT +L

Then Select The project that your are developing and right click on that.

Then select the Properties from the submenu.

Then select the Configuration properties from the Tree structure. under that select C/C++ then select Advanced. Now in the right side pane change the property

Compile As from Compile as C++ Code (/TP) to Compile as C Code (/TC)

Finally change your file extensions to .c

Now you configured you Visual Studio to compile C programs

And you can use NetBeans too it could even be more user friendly than Visual Studio download it you wont regret i promise

The problem with learning C within Visual Studio is that you are compiling C using the Visual Studio C++ compiler. You might want to try learning C using the GNU GCC compiler from within the Cygwin environment in Windows.

Simple and sweet: Console applications (basic C programs using printf and such) are easily and cheaply done with the Tiny C Compiler - a no frills, no gui, complete C complier.

http://bellard.org/tcc/

However, C development is relatively simple on Visual Studio as well. The following instructions will set Visual C++ up as a good C compiler, and it will produce console applications at first, and yo can move up into more complex windows apps as you go.

  1. Get the Visual Studio C++ edition (express is fine)
  2. Start a new project - disable pre-compiled headers (maybe the wizard will let you do this, maybe you'll have to change the compiler settings once inside the project)
  3. Delete everything inside the project.
  4. Create a new "example.c" file with the hello world example
  5. Compile and away you go.

Alternately, get a linux virtual machine, or Cygwin. But as you already have Visual Studio, you might as well stick with what you know.

As an aside, this isn't Atwood learning C finally, is it? No ALTs! ;-D

-Adam

Bloodshed Dev-C++ is the best windows C/C++ IDE IMO: http://www.bloodshed.net/ It uses the GNU compiler set and is free as in beer.

EDIT: the download page for the IDE is here: http://www.bloodshed.net/dev/devcpp.html

As already said, you should check out the VS.net C++ edition, but if you'd like to try something else Eclipse has a C++ edition. You can get more info from http://eclipse.org or check out the distro at http://www.easyeclipse.org/site/distributions/cplusplus.html

The problem with learning C within Visual Studio is that you are compiling C 
using the Visual Studio C++ compiler. You might want to try learning C using
the GNU GCC compiler from within the Cygwin environment in Windows.

This is a legitimate response, I posted an IDE that uses the GNU compilers, so why has he been down modded?

This is the type of thing that will make me not use SO, why down mod someone just because they are recommending a different compiler, and IMHO, a better one then Microsoft's?

get real people, and @Antonio Haley I gave you +1

Some people say that a smaller IDE is better for learning. Take a look at Code::Blocks. It's generally true that beginning C in an IDE is hard because not many books explain enough to control the IDE. Perhaps starting in a console and a basic text editor with syntax highlighting would be better – at least under Linux. Since Windows' console is far from great, I'd not recommend using it.

/EDIT: Dev-C++ used to be the best freely available IDE for Windows. However, it's development has been discontinued years ago and the most recent version unfortunately is full of bugs.

There's a very good reason to learn C and C++. The reason is that there's a lot of C and C++ code out there that are performing very real and important tasks. Someone who considers themselves a programmer and a learner(doubtful that you can separate the two) can learn a lot from these lines of code.

You can learn a lot from each language by studying the other, but if you really want to grok C it's a lot easier to separate yourself from anything C++ for a while. Visual C++ is great but GCC is a great way to thrust yourself into vanilla ANSI C without having to mentally sidestep any C++.

@mmattax thanks!

C in Visual Studio is fine, just use the command line compiler that is included in the Pro edition. Yes its the C++ compiler but treats all files ending .c as C . You can even force it to treat ALL files as C with a switch. The VS documentation has entries on it, just search the index for Visual C.

Visual Studio is one of the best IDEs for C/C++. I don't think it is complicated and hard to use - if you have questions about it - ask them. Some other compilers/IDEs are fine too, but if already have Visual Studio and have used it - why not stick to it?

For plain C, I suggest Pelles C. Generates optimized code and supports C99 constructs.

Features:

  • Support for 32-bit Windows (X86),
  • 64-bit Windows (X64), and Windows Mobile (ARM). Support for the C99 standard.
  • Integrated source code editor with call tips and symbol browsing. Integrated source-level debugger. Project management.
  • Inline assembler for X86 and ARM.
  • Integrated resource editor. Integrated bitmap, icon and cursor editor. Integrated animated cursor and video editor.
  • Integrated hex-dump editor.
  • Supportfor custom controls in the dialog editor. Support for custom project wizards. http://www.smorgasbordet.com/pellesc/

When i used visual studio 5.0 it should compile c code as long as the header files and lib. are there for the compiler to find. In fact most C++ compilers like G++ will compile C code just fine. But i'm not sure how well.. If you are targeting a platform then you can change the header files and lib. within you IDE and Compiler.

Visual Studio has a great debugger that no other Compiler that i have seen can compete with. I have been using gcc darwin10 4.2.1 and find the debugger is basically just the one you can getfree with any linux flavor. I recommend you learn both on a plain vanilla gcc compiler and also try visual studio which costs money. The express edition does not allow the use of threading and several other things that I forgot about. Visual Studio 5.0 should be ok to use and the debugger is much more human friendly then the one commandline version called GDB. Try DDD on linux which is similar to XCODE's debugger.

Although C++ and C are different you can compile both together. But you should understand each ones flaws and good points. C code is faster, but C++ is much easier to write and manage larger code. C++ is object oriented but C is procedural while they are both imperative languages. I would suggest learning objective-C since you can use both C++ and C libraries. Using the features you like in all three languages!!!

Visual Studio or Express do consider .c files as C code, but the compiler will keep giving warnings, and irritating suggestions which you do not require, in the debugger. Gives an indication that Visual C++, as the name suggests is optimized for C++ development for the Windows Operating system, which was originally written in plain pure C.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top