Next Previous Table of Contents

### 9. Build Settings

The Project Options dialog, accessed by the project menu, lets you specify all needed parameters for your project. Those will be used for the Makefile.am's and the configure.in script (e.g. version number change or compiler warnings ) and thereby set the compilation preferences as well.. After changing the project options, you should invoke "make clean" or "rebuild all" to compile your project with the new options. Please mind that debugging is only available if the project options are set to create debugging information, the amount can be set with the debug level (0-3). If you add functions that belong to a library that is not included in the Linker flags, your program will not link correctly if those are not updated, so keep track of your library linking.

For a release build of your application or for distributing the sourcecode package, you should watch the following standard settings:

- disable debugging
- enable optimization and set optimization level to -02
- set the compiler warnings to -Wall
- for each new release, increase the version number and update the project.lsm file for version and requirements.

### 9.1 General Options

The first page of the Project Options dialog sets the general options for your project. These are project name and number, the handbook sgml file which is used for generating a set of HTML files that are included in the project and specific information about the author. The short description field is for additional information that you want to include like the program's purpose and the like.

### 9.2 Compiler Options

The compiler options page sets the compiler flags towards your target, debugging and additional.

#### Target

The target box contains three options that can be set:

Target Machine: You have the choice to set the target machine option here by choosing between your machine (default) and i386v, which is the option if you configured your Compiler as a cross-compiler for an Intel 386-compatible machine running System V. This option sets the -b flag to the Compiler. Usually you would leave this to the default.

only syntax-check: If checked, the -fsyntax-only flag is set. This means that the Compiler will check your code only for correctness in regards to the syntax, but doesn't check anything beyond that.

Optimize: You can enable optimization for your build process by this option, meaning to set the -O flag. If not checked, the flag is set to -O0, so no optimization will be used. If you enable optimization by checking this option, you can as well specify the optimization level below from 1 to 3.

For a release version of your application, enable optimization and set the level to 2.

#### Debugging

Right of the Target box, you can see the debugging-section. This means that you can set your Compiler to include information for debuggers within the final binary, so the programmer can follow the execution of the application with the debugger in direct context to the sourcecode.

Enable debugging therefore sets the -g flag; the debugging level specifies the amount of information to be included in the binary. Available are level 1 to 3 to choose from. Mind that the binary execution will be slower by setting any debugging option and that the binary size will increase by the debugging level.

Generate extra information for gprof: sets the -pg flag, resulting that the Compiler will include information for the gprof program that displays caller graphs of your program's function.

Store temporary intermediate files: sets the -save-temps flag. This will result in storing the usually temporary files produced by the preprocessor and the assembler. A compilation of a sourcefile will therefore produce three output files: an *.o file which is the final output of the Compiler, an *.i file produced by the preprocessor and an *.s file as the output of the assembler.

For a release of your project, disable any debugging.

#### Additional Options

The text entry field on the bottom is intended for you to manually set any flags for the Compiler by setting the CXXFLAGS environment variable in the Makefiles, so make sets the flags before the build process and reset them afterwards. For a complete description of all available Compiler flags you should see your Compiler documentation; for gcc and egcs this can be done by man gcc; man g++ will show you information about the c++ script that is used to lead the Compiler.

### 9.3 Compiler Warnings

The following gives a description about the Compiler warning options that can be set on page 3 of the project options dialog. The explanations are taken from the man page for GCC, egcs version 1.1.1. The warnings themselves are diagnostic messages that indicate that constructions may cause errors.

-Wall

  Standard `-W' options combined.

-W

  Compile with -W. This option sets options not included in -Wall which are very specific. Please read GCC-Info for more information.

-Wtraditional

  Warn about certain constructs that behave differently in traditional and ANSI C.

-Wundef

  Warn if an undefined identifier is evaluated in an `#if' directive.

-Wshadow

  Warn whenever a local variable shadows another local variable.

-Wid-clash-LEN

  Warn whenever two distinct identifiers match in the first len characters. This may help you prepare a program that will compile with certain obsolete, brain-damaged Compilers.

-Wlarger-then-LEN

  Warn whenever an object of larger than LEN bytes is defined.

-Wpointer-arith

  Warn about anything that depends on the «size of» a function type or of void. GNU C assigns these types a size of 1, for convenience in calculations with void * pointers and pointers to functions.

-Wbad-function-cast

  Warn whenever a function call is cast to a non-matching type. For example, warn if `int malloc()` is cast to `anything *.`

-Wcast-equal

  Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a const char * is cast to an ordinary char *.

-Wcast-align

  Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a char * is cast to an int * on machines where integers can only be accessed at two- or four-byte boundaries.

-Wwrite-strings

  Give string constants the type const char[length] so that copying the address of one into a non-const char * pointer will get a warning. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using const in declarations and prototypes. Otherwise, it will just be a nuisance; this is why we did not make `-Wall' request these warnings.

-Wconversion

  Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed point argument except when the same as the default promotion.

-Wsign-compare

  Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.

-Waggregate-return

  Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, this also elicits a warning.)

-Wmissing-prototypes

  Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. The aim is to detect global functions that fail to be declared in header files.

-Wmissing-declarations

  Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. -Wredundant-decls Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing.

-Wredundant-decls

  Warn if anything is declared more than once in the same scope even in cases where multiple declaration is valid and changes nothing.

-Wnested-externs

  Warn if an extern declaration is encountered within an function.

-Winline

  Warn if a function can not be inlined, and either it was declared as inline, or else the -fin*line-functions option was given.

-Wold-style-cast

  Warn if an old-style (C-style) cast is used within a program

-Woverloaded-virtual

  (C++ only.) In a derived class, the definitions of virtual functions must match the type signature of a virtual function declared in the base class. Use this option to request warnings when a derived class declares a function that may be an erroneous attempt to define a virtual function: that is, warn when a function with the same name as a virtual function in the base class, but with a type signature that doesn't match any virtual functions from the base class.

-Wsynth

  Warn when g++'s synthesis behavior does not match that of cfront.

make all warnings into errors

  (-Werror) Treat warnings as errors; abort compilation after any warning.

For a release of your project, it is recommended to enable -Wall.

### 9.4 Linker Options

The Linker Options for your current project can be set by the last page of the project options dialog. You have to enable those libraries that your application uses to link them to your binary with the Linker, e.g. your application uses the class KFileDialog. As the class KFileDialog is part of the KFile library, you have to enable kfile. For classes or functions that are not listed as checkboxes, use the "additional libraries" field.

#### Linker Flags

remove all symbol table and relocation information from the executable:

  This means that all redundant information will be removed from the object files and the binary, resulting that debugging will not be possible. For as long as your application is in a development stage and not released as final, you should leave this option disabled.

prevent using shared libraries:

  This option disables the use of shared libraries on systems that support this. On systems using no shared libraries, this option will have no effect.

additional flags:

  Here, you can enter additional flags for the Linker, setting the LDFLAGS environment variable by make. The available options can be taken from the man page for ld or your Compiler manpage.

#### Libraries

The libraries section contains checkboxes for the most needed libraries in conjuction with Qt/KDE application development. You have to enable those libraries that your application uses, otherwise the Linker will complain about unresolved symbol tables.

X11

  The X11 library. Recommended for all X-Window programs.

Xext

  The X11 extension library. Also most X-Window programs depend on Xext.

qt

  The Qt-library. Recommended for Qt and KDE applications.

kdecore

  The KDE Core library; contains the classes for KDE Application frameworks.

kdeui

  The KDE User Interface library; contains KDE-specific widgets.

khtmlw

  The KHTML Widget library.

kfm

  The KFM library containing classes for KFM functions.

kfile

  The KFile library. Contains file dialogs etc.

kspell

  The KSpell library. Contains an interface for programs to use Ispell for spell-checking.

kab

  The KAdressBook library. Needed for access to the addressbook as well as providing addressbook widgets

additional libraries: Here you can enter additional libraries that your application needs, e.g. the KOM library. Set the libraries with the -l option; for the example -lkom.

#### Make

As GNU make supports some useful options, the Project Options dialog contains a page called "Make-Options", where those can be en/disabled. The available settings are:

Print debug information

  prints out all information about the project files and what make determines for rebuilding them.

Continue after errors

  tries to continue with the compilation after an error occurred (e.g. a file couldn't be compiled due to an error)

Print the data base

  prints out the make-database for the current process which contains the changes from the last build-run.

Environment variables

  give the current environment variables a higher priority than the currently used variables in the Makefiles.

No built-in rules

  doesn't use built-in rules for make.

Touch files

  don't run the Compiler on changed files; instead only touches them. This sets them as already processed by make.

Ignore all errors

  Ignores all errors that occur

Silent operation

  doesn't print out any information about the build-process

Print working directory

  prints the current directory during the make-process.

job number

  sets the amount of parallel processes for make. For a single-CPU system we recommend setting this to one or two.

set modified

  sets the selected file modified. Choose the file by clicking the folder button on the right. Setting a file modified means that the file will be processed by make and compiled if it is a source file.

additional options

  set additional options to make; those can be found in your local man page for "GNU Make".

Next Previous Table of Contents