Cygwin – Makefile-error: recipe for target `main.o’ failed

You see the two empty -D entries in the g++ command line? They’re causing the problem. You must have values in the -D items e.g. -DWIN32 if you’re insistent on using something like -D$(SYSTEM) -D$(ENVIRONMENT) then you can use something like: in the makefile which gives them default values. Your output looks to be missing the all important output: just to clarify, what actually … Read more

How to convert C++ Code to C

There is indeed such a tool, Comeau’s C++ compiler. . It will generate C code which you can’t manually maintain, but that’s no problem. You’ll maintain the C++ code, and just convert to C on the fly.

Why is %c used in C?

Because %d will print the numeric character code of the char: prints 97 (on an ASCII system), while prints a.

Categories C Tags

What is the difference between exit(0) and exit(1) in C?

What is the difference between exit(0) and exit(1) in C language? exit(0) indicates successful program termination & it is fully portable, Whileexit(1) (usually) indicates unsucessful termination. However, it’s usage is non-portable. Note that the C standard defines EXIT_SUCCESS and EXIT_FAILURE to return termination status from a C program. 0 and EXIT_SUCCESS are the values specified by the standard to indicate successful termination, however, only EXIT_FAILURE is the standard value for … Read more

Categories C Tags

What is a file with extension .a?

.a files are static libraries typically generated by the archive tool. You usually include the header files associated with that static library and then link to the library when you are compiling.

error: indirection requires pointer operand (‘int’ invalid)

The purpose of this code is to pass a virtual address in decimal and output the page number and offset. After I compile my code using the gcc compiler on Linux I get this error: indirection requires pointer operand (‘int’ invalid) virtualAddress = *atoi(argv[1]);

Categories C Tags