How to compile and run C code? [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have purchased The C Programming Language ANSI C Version book for learning C. In that, there is no instruction for setting up the environment for developing the C programs.
Please help me how to compile and run the code explained in the book.
EDIT : I have Windows 7 installed as the OS"

You should use an IDE (Integrated Development Environment). I've chosen Code:Blocks a long time ago and I am still happy with it. Alternatively you can use NetBeans, Eclipse, DevCpp, ... There are a lot of IDEs for C or C++ available.

If on Mac/Linux, you can simply use make myprogram (in a terminal) to easily compile a single-file C program where the source file is called myprogram.c
For more complex programs with several source files, system dependencies et c, it quickly gets much more complex. Use google to find the basics of GCC, the default compiler on UNIX systems.

If you're on Windows, you could either use the Visual Studio from Microsoft (excellent, but not free) or Eclipse with CDT.
This provides you a full IDE with nice debugging support.
However, if you don't want to use an IDE but learn to build programs from scratch, cygwin would be an option including GCC and Make.

Related

What is the latest version of TurboC? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
In my college they have prescribed Turbo C, for my academics. I know it is pretty old, but I want to download the latest version of it. I have a turbo c of 1980, a DOS version.
Is any latest version available for it?
Is Borland C++ is different from Turbo C++?
There are no "latest version" of these products -- Turbo C was discontinued in 1990, and Turbo C++ in 1993. Both are over 20 years old (they may very well be older than you are!), and will only build 16-bit DOS executables which won't even run on most modern computers. They cannot be used to interact with any sort of modern programming APIs -- in particular, they cannot interact with the network, nor can they create a standard Windows user interface. Basically, you're stuck in the past.
I won't go quite as far as to say that you should find a better school. But you should keep in mind that what you are learning will be almost entirely irrelevant to your employment -- a lot has changed in the last 20 years, especially for C++. (The C++ STL wasn't even fully standardized in 1993, so there will be some significant differences even there.)

C Programming On Windows - For Someone Who Used To Do It On Ubuntu [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Backstory: I have searched around and read some questions from SO, but I am still somewhat confused.
I learnt C at University, only been here 1 semester and we're on break.
I learnt to program in C under a Unix environment, Mac OS X and Ubuntu and it was dead easy.
Open terminal, install GCC, start using vim and writing some make files for your projects and you're done.
I have removed my Ubuntu partition since I only used it for C programming, I am too grounded in Windows (games etc...) and I am looking for a similar experience on Windows.
I don't particularly want to install anything from .NET at all, since it's never just the application, but 500000 other useless things - which pisses me off to be honest.
TL;DR;
I heard MinGW was using an extremely old version of gcc and isn't maintained, otherwise I would be using that.
So does anyone know of a gcc, no nonsense port or otherwise for C programming on Windows?
I can use Notepad++ for writing the .c files and syntax hilighting, I don't care about an IDE at all.
The easiest way would probably be to install cygwin (you may need to explicitly select "gcc" from the development section). If you had worked on unix, it would probably be a good idea to cygwin on your windows machine anyways.
You can use an IDE such as visual studio that will bundle all the needed features (compiler, libraries, etc)
If you don't want to bother with an IDE and prefer the lightness of vim, installing it on windows and compiling in the CLI is a pain, Cygwin is cool (see other answer) but I can't bear the windows terminal compared to the Linux / Mac ones.
Maybe consider using a Virtual Machine running Ubuntu for all your development.
The answer to your question is NO.
You either use MinGW, or you use Visual Studio. There is no lightweight third option, unless you want to use Turbo C.
I am using MinGW now - I was informed incorrectly about it using an outdated version of GCC.
In a way, I suppose I deserve the down votes for not checking myself.
Oh well, you live and learn.
Try these:
CodeBlocks:
http://www.codeblocks.org/
Eclipse, as someone mentioned earlier too;
-older versions of programs are good for learning too like:
Borland C++ 3.1
Turbo C
(both DOS based)
Try Visual studio 6.0 :)
no .NET on that release.

C Programming and vim [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have practically no experience with programming outside of ide's (Microsoft Visual Studio, netbeans and eclipse) and I am beginning to learn C programming. I have adequate experience with C++ and Java. I have downloaded gVim 7.3 and am looking for some guidance on how to program in C with vim. I do not even know where to type code with vim! I am completely lost and am looking for instructions to run simple command-line programs such as hello-world (to start). Also, would notepad++ be of any use?
Somebody please show me the world of C programming and Vim
Usually its done like this - you open up a shell window, set your compile enviroment configuration. Then open any files you are working on with gvim to have a C syntax highlighting available, modify them and save. Get back to shell window repeat make command or whatever you need to compile and link application.
The usefull extension for me was ctags, which allows to browse declarations. You dont get the comfort of code completions, intelissence, on-the-fly error messages or list of function parameters, but I didnt miss that much eitherway.

Unix source code- finding my way around [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm quite interested in getting "stuck in" to some Unix source code, say Fedora or Ubuntu.
In practical terms, how would one "re-write" some part of the Unix OS. I presume you would need two machines, a dev machine and a tester? Would you need to re-install the OS on each modification of a .c file? How could I edit the file and re-compile it etc?
What resources are there for knowing which parts of a Unix OS/Kernel relate to which C files (I presume there is no C++) and how to find them?
Thanks in advance for help
ps my motivations for doing this are to eventually be able to learn more about the lower-level fundamentals of the Unix OS, so that I could try and get into programming high freq trading systems.
I think it would probably be a good idea to have some kind of virtual machine to experiment with, that way you could do a snapshot apply your changes but still be able to go back without much effort. Also it allows you to simulate communication between PCs in a simple fashion.
First you need to know what you're looking for. You want to download and look at the: linux kernel. Which is the same for Fedora and Ubuntu (and all other GNU Linux distributions). Second, you might want to start with something easy, like downloading the kernel, configuring and compiling it and booting it. Once you do that you can move up from there.

how do you run a c program in cmd [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I've opened the cmd in windows and I've created a directory by using md command. After that I've opened a text file via notepad <name>, wrote my program and gave .c extention while saving the file.
How can I compile and run my C program to get an output? I've also other programs in my directory: how can I create .exe files for all of them?
Free (beer-free, not necessarily speech-free) C compilers for Windows include (from memory so there may be others):
MinGW (Minimalist GNU for Windows)
MSYS
Cygwin
Eclipse CDT (which uses GNU under the covers I think)
Borland C++ (from their BDN museum site)
Visual C++ Express
Maybe this c compiling handout can be of any use.
It shows all the steps needed to create a c based executable file.
You need a compiler - are you using Visual Studio? GCC? The compiler you are using should come with some simple setup instructions to help to get you going.
I would recommend if there is no reason to use MS windows, try linux.
http://www.ubuntu.com/testing/intrepid/beta
The development environment is free.

Resources