A project is a set of source files that is translated into a single executable by the integrated development environment.

Creating a Project

This option allows you to define the set of files that will be loaded together and considered as a work unit. For this you have to define:

  1. The name of the project

  2. The directory where the source files will be found

 The object files and the executable are placed by default in a directory named 'lcc' under the sources directory. For instance. if you use the directory c:\myproject for the sources, the output  of the compiler will be placed in a directory named 'c:\myproject\lcc'. This method is not obligatory in this version, but it was in earlier versions of Wedit. Still, it is better (as always) to use the defaults.[1]

 Avoid placing two completely unrelated projects in the same directory. The makefiles would be erased and several object files could be lost. For example, if you have a file called main.c in two projects, the object files of both projects would be the same and the linker would be confused.

Four types of projects are supported:

  1. Windows executable. This means that your program will start at the ‘WinMain’ function, that it will not use the standard input or standard output functions and that it will not use the ‘console’ window.[2]

  2. Console application. This means that your program uses ‘printf’ and assumes, for example, that stdin and stdout are initialized and it will appear in a text mode window.[3]

  3. Static library. This means that you want to create a library containing a set of object files. This library is linked statically, i.e., each executable will contain its own copy of the routines in the library.

  4. Dynamic link library. This means that you will create an executable that is dynamically attached to another process when the other executable starts.


 Creating Several Projects under the Same Directory

From the same source set, you can create different projects that use some of the files in the sources directory. For instance under the project \myprojects\accounting, you could create several projects that use some of the same sources under that directory for setting up different executables, a DLL, a library, etc. You can do this if you change the item ‘Project directory’ in the definition of the project. Since the object files are stored in different places, there is no risk of mixing them up.

 Defining the Files to be used by the Project

When you accept by pressing the 'Create' button, the system will ask you if you want to use the wizard to generate the code for the skeleton of a new application. If you answer yes, the code generation wizard starts. If you answer no, the following dialog box appears:

You reach this dialog box either by choosing ‘Create’ in the project options, or by choosing ‘Add/Delete files’.

This is the standard dialog box for project file maintenance.

To add a file, choose a file from the list box at the upper left or type its name in the corresponding entry field, then click on the ‘Add’ button.

To remove a file, select it first in the list box at the bottom, then click on the ‘Remove’ button.

 

Here you should enter the names of all files that will create this project. You can enter them quickly if you click on the ‘Read file list from a text file’ button.

 If your project uses special libraries, add them to the project files here. For instance, if you want to use the Windows sockets primitives for network programming add ws2_32.lib. You can enter the library without a path. If no library is found in the current directory with the name you typed, Wedit will search in the system \lcc\lib directory, and determine the path for you.

 If you are building a Windows executable, you should add your resources, either by adding a .rc file or a binary .res file. Use the combination box with ‘List files of type’ header to choose the different files that you want to add to the project.

When you have chosen all the files, click the ‘Validate’ button and the following dialog box will appear.

 

You can reach this dialog box either when you create a new project or by using the ‘Configuration’ option from the ‘Project-Configuration’ menu bar.

 

 

This dialog box lets you change/add/modify the settings for the compiler, choose the level of debugging support, etc. This will be explained in full in the corresponding chapter.  This is the same dialog box that you reach from the ‘Configuration’ tab in the ‘Options’ main menu. It is just displayed differently.

 This is the first of a series of three dialog boxes that the system presents to you in the event that you want to modify some of the settings at the start of a project. Choosing the ‘Next’ button allows you to continue.

 This is a good place for adding the #defines that your project may need or a special library that is not included in the default libraries. By default, the compiler will start the project with a debug setting (debug information turned on, optimizations off), but you can also change this here.

 The next two dialog boxes (shown later in the ‘Compiler’ chapter) concern the linker and the debugger settings. Once finished with the settings, Wedit will generate a Makefile for your application using the available information.

 The project is then ready. You can compile and execute your application. You should wait, however, until Wedit finishes generating the Makefile for your application. This can take a few seconds, since Wedit calls up the compiler to determine which files are used for each of the files you added to the project.[4]

The structure of the Makefile that is generated is described in the technical documentation.

 



[1] The current directory can be determined easily: just go to the configuration menu option. In the ‘General’ tab, you will find what the current directory is.

[2] Of course windows program can open an own console if they wish to. This refers to what is present by default at the program startup.

[3] Again, console programs can use any window API. The system opens a console for them by default at the program startup, that’s all.

[4] It could be argued that calling the compiler for this is an overkill, and just scanning for #include statements would suffice. The problem is that #ifdef ... #endif statements, that need to be processed in order to know which files are actually used by a source module.