Hi!
I have been learning c language on linux for two months.Today I have changed to Windows
and don't know how to ,where to write programs and compile them and execution.Please exlain me.
(Windows-7,acer)
Thanx.

Dani AI

Generated

A compact, practical roadmap for moving simple C work from Linux to Windows — complementary to the split suggested by and (IDE vs command-line). The goal is a minimal, reproducible workflow and a few portability gotchas that often confuse people who are used to a Linux toolchain.

Create a plain-text file with a .c extension, put it in a simple folder (for example C:\projects\hello), and use either an IDE (project template, build/run/debug buttons) or a command-line compiler. A minimal example source and the generic compile/run sequence look like this:

#include <stdio.h>

int main(void)
{
    printf("Hello, world!\n");
    return 0;
}

From a Windows terminal (Command Prompt or PowerShell), change into the folder and invoke the installed compiler with a command of the form:

<compiler> -o hello.exe hello.c

then run the produced executable (PowerShell often needs .\hello.exe; cmd may accept hello.exe).

Common pitfalls and portability notes: Windows uses CRLF line endings (editors vary in handling LF-only files), filenames are normally case-insensitive, and POSIX-only headers or functions (for example, unistd.h, fork()) are not available by default. If a "command not found" error appears when compiling, the compiler's bin directory is not on PATH. Long or space-containing paths often require quoting. Newly built executables can trigger UAC/antivirus prompts on some systems — running the terminal with elevated rights is sometimes necessary for installation steps, not for ordinary compilation.

Quick checklist: pick IDE vs command-line based on preference, save .c files as plain text, learn how to invoke the chosen compiler from a terminal, read compiler error messages carefully, and substitute or conditionally compile any Linux-specific APIs for Windows equivalents when porting non-trivial programs.

Recommended Answers

All 2 Replies

I think you could install a GCC version for Windows through Cygwin. When I was programming on Windows, I was using an IDE, Code::Blocks.

There are many ways to compile code on Windows similar to Linux.

If you used an IDE on Linux, then Code::Blocks is a great suggestion, as is Visual C++.

If you used the command line then you can install Mingw which is like GCC and works through the command line, it takes the exact same syntax as GCC too, so you'll be familiar with it.

Code::Blocks uses Mingw as a backend too, so if you want to play around with both you can.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.