Using a C/C++ compiler

To use a C/C++ compiler:

In the Paths tab:

  • Set the location of the compiler
  • Set the location of the linker
  • If the compiler requires any additional command line flags, add them in the General tab.
  • If the linker requires any additional command line flags, check the Use special linker options, and enter them below, otherwise, uncheck the box.

    In the Compatibility tab:

  • Check "Use C Compiler"

    To be sure you receive all error messages, be sure the compiler does not call the linker itself. This is not a problem with lcc-win32, but see the section on Additional notes for specific compilers for information on using this option with Visual C++ and cygwin. Also be sure to see this section regarding incompatibilities with DJGPP.

    Individual files can be compiled and run as usual. Using the Compile option will cause the compiler to create an object file, while using Run this class will cause the linker to attempt to create an executable file from the object file and attempt to run it. When using a project, all files will be compiled together to form one executable. To choose the name, enter the desired name of the executable (without the .exe) in Project settings. (Note: If the name does not correlate to one of the source files in the project, then the executable is assumed to be placed in the directory of the first source file alphabetically.)

    Important note: Due to compatibility issues with Java processes, the following line must be added somewhere in the main() function in each application you write which uses stdout to make it unbuffered:

    setvbuf(stdout, NULL, _IONBF, -1);

    This must be done before any output is done using stdout. If this line is omitted, stdout may be blocked until it receives 2-4K of output.

    Note: This does not affect C++ applications using only the iostream library.

    Related Links:

    Additional notes for specific compilers