I'm currently learning to code in C and I use Cygwin64 to compile the code, as of now I'm using Notepad++ as my text editor and I would like to be able to compile my code using the plugin nppexec instead of having to close notepad++, compile and then open it again. The only problem is that the majority of nppexec scripts for C use mingw and not cygwin, Are there any nppexec scripts for C that use cygwin64?
-
Install eclipse, stop wasting time. – 0___________ Jun 17 '20 at 16:23
-
3Do yourself a favor and use a fully fledged IDE, preferably with nativ support for C++. there are some beyond excellent free options in 2020 like e.g. Visual Studio Community and a few more. – bolov Jun 17 '20 at 16:24
-
Notepad++ is just fine for a starter IDE. When you outgrow that, geany is the next step up. Full IDEs do a lot of work for you, but it much better to understand the basics of editing, compiling and linking before moving to a full IDE. Learning to use an IDE is not trivial, each one is different, and if you don't have one, your will be stuck, if you don't know the basics. – Doug Henderson Jun 18 '20 at 20:44
4 Answers
Something like this: Final Setup of gcc in Notepad++ [using nppexec] ?
Notepad++ is a great program, but it's hardly an IDE. It doesn't understand your code so it can't do smart code completion and doesn't allow you to do any debugging.
For example Code::Blocks is a good free IDE.
Also, if you want to learn C, I don't see why you use Cygwin. Only use Cygwin if you really need to port Linux/Unix stuff to Windows that won't build with other toolchains.
You should go for MinGW-w64 instead.

- 6,215
- 1
- 16
- 40
-
I'm only using a text editor because the book I am learning C from (Learn C the Hard way by Zed Shaw) recommends it for learning new languages. – King Jun 18 '20 at 12:05
Are there any scripts for compiling C code with cygwin for nppexec?
Do yourself a favor, learn to use the command line interface.
Read the Modern C book.
Avoid weird characters (notably spaces) in C source file names. So use foo-bar.c
or foo_bar.c
but not foo bar.c
(with a space after second o
).
For your source code editor, consider GNU emacs or vim or Visual Studio Code (or some other IDE of your choice). But remember that most C compiler programs (including tinycc, nwcc, GCC -which cygwin
provides-, Clang, even Visual Studio is at heart its cl
command) are transforming a C translation unit (practically your foo.c
file) into an object file (e.g. foo.obj
on Windows, foo.o
on Linux or MacOSX) and don't have natively any GUI for that. Later some linker is needed.
Compile thru a build automation tool such as ninja or GNU make.
Use a version control system, such as git.
In many cases, it is interesting to generate some of your C code (so called meta-programming approaches). Look into tools like SWIG, ANTLR, GNU bison, rpcgen, or those supporting ASN-1 listed here. For GUI interfaces, consider using GTK and related code generator tools, such as Ggen. For JSONRPC services, see jsvggen. With a command line interface approach, taking advantage of these tools is easy. Look also, for inspiration, into the open source code of many bootstrapped source to source compilers emitting C code, such as Bigloo or Chicken/Scheme or S48.
Learn to use a debugger, such as GDB or LLDB. Debugging information (e.g. DWARF) needs special flags at compilation time, so with GCC, use gcc -Wall -Wextra -g
to get warnings and debug info.
Cygwin is wrapping the GCC compiler.
For embedded cross-compilation for Arduino or RaspBerryPI devices, the C cross-compiler is also a command-line tool.
Spend several days to read the documentation of cygwin and of GCC.
Of course, read the documentation of every tool mentioned here.
Cygwin is Unix inspired, so be aware of the Unix philosophy.
NppExec is a plugin for Notepad++ which has its documentation somewhere.
For inspiration, study the source code of existing open source software on github and gitlab.
PS. Consider perhaps installing a newbie-friendly Linux distribution such as Debian or Ubuntu on your PC laptop (if you prefer the original: a good GNU/Linux distribution to its imitation: Cygwin). Be sure to backup your important data before trying. You'll need a hundred gigabytes of disk space to be at ease, and you could have a dual boot setting: Linux for software development, Windows for games.
PPS: every software mentioned above (except some MicroSoft compilers) is open source and exists on Debian or on Ubuntu. You could later be interested by Linux From Scratch. Read also for your information this draft report (work in progress in June 2020).

- 223,805
- 18
- 296
- 547
-
yes, CLI is great and gives you the opportuninty to do many things much faster than usual GUIs. – codegorilla Jun 17 '20 at 18:58
Cygwin includes the mingw cross-compilers. Look for the mingw64-i686-gcc-g++ and mingw64-x86_64-gcc-g++ packages in cygwin setup. These are almost the same compiler packages you can install with pacman when you have installed the mingw64 system.
In your makefile, change CC=gcc to CC=/bin/x86_64-w64-mingw32-gcc.exe to compile 64 bit exe's, or CC=/bin/x86_64-pc-cygwin-gcc.exe for 32 bit exe's. The resulting executables do not depend on the cygwin DLL. In the simplest cases, they only depend on windows DLLs.
There is a huge collection of mingw64 packages available to install.

- 785
- 8
- 17
Do yourself a favour, do not learn to use the command line at this stage.
If you use Windows 10 install VisualStudio
You do need cygwin anymore as Windows 10 has native Linux subsystem. You can install your favourite distribution there (I would recommend the Ubuntu as the instructions are for Ubuntu).
Follow the instruction: https://devblogs.microsoft.com/cppblog/targeting-windows-subsystem-for-linux-from-visual-studio/
Enjoy.
When you learn C a bit you can start to learn make or other build systems. Learning command line GDB IMO in 21st century is not needed at all. There are so many convenient GUIs and integrated environments for it

- 1
- 1

- 60,014
- 4
- 34
- 74
-
4I don't really agree. If you plan to develop for more operating systems than just Windows it's good to know some command line, as this is what they have in common. I (virtually) went to Microsoft's Open Source summit yesterday and even there it was mentioned by Microsoft people that they believe command line is there to stay. That's why they focus so much on PowerShell and why they have brought the bash shell to Windows. The Linux subsystem is great for developers and techies, but that won't be the target for Windows software that is distributed. That's why MinGW-w64 is so succesful. – Brecht Sanders Jun 17 '20 at 18:49
-
2@BrechtSanders the OP learns C. He is far from the problems you wrote about. To learn C, to expremint, change something IDE with graphics debugger is 100% the best. – 0___________ Jun 17 '20 at 20:53
-
1The [*Modern C*](https://modernc.gforge.inria.fr/) book *explicitly* recommend using the command line. – Basile Starynkevitch Jun 18 '20 at 04:55
-
1The Linux subsystem on Windows is called [WSL](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). – Basile Starynkevitch Jun 18 '20 at 05:14