The GraphApp.zip file contains the following files:
GraphApp.zip = COPYLIB.TXT arith.c events.c
README.TXT bitmaps.c fonts.c
graphapp.prj buttons.c init.c
graphapp.dsk context.c menus.c
example.prj controls.c objects.c
example.dsk cursors.c strings.c
pizza.c dialogs.c windows.c
graphapp.h drawing.c xredef.c
graphapp.c drawtext.c internal.h
The project files (graphapp.prj and example.prj) are Borland C++ version 3.11 projects. They won't work on other compilers. The pizza.c file is an example program for use with the example project, to demonstrate how to use the library.
The graphapp.c file is the file you should compile to make the library.
COPY graphapp.h C:\BorlandC\Include
Why do this? Because then your C programs can use the line
#include <graphapp.h>
to include the file. When the compiler sees the angle brackets
< and > around a file name, it tries to find that file in its
include directory.
You don't have to put the file there. You could copy the graphapp.h file into the directory where you are compiling programs, and use the following line in your C programs:
#include "graphapp.h"
When the compiler sees the quotes "" around a file name it looks for
it in the current directory, where you are compiling.
#include "graphapp.h"
void main(void)
{
gprintf("Hello world.\n");
}
What does 'make' do? It compiles your .c file and links it to the graphapp.lib library file. This should be all you need to do to get programs running. You can also use the 'run' option which should be in one of the menus, which will 'make' the project then run it.
The .c files are the source code files used to build the library, while the internal.h file is only used inside the library, never by your programs. The COPYLIB.TXT file simply states the terms under which you are using the GraphApp source code (basically you cannot use it for commercial purposes unless you use it in an unmodified form).
The graphapp.c file is the main file you will want to compile. It includes the relevant source code files automatically.
Otherwise, here are the instructions for doing it:
If all goes well, you will have produced a new graphapp.lib file for use with your compiler. If all doesn't go well, forget it and use the next method instead.
There is a way you can get GraphApp programs to work by directly linking your source code to the source code files which come in the GraphApp.zip file. Here's how:
#include "graphapp.h"
void main(void)
{
window w;
w = newwindow("Testing", rect(20,20,200,200),
StandardWindow);
show(w);
}
Remember the .c files which come with GraphApp are the source code files for the library. If you modify them you may break the library. Then you'll have to unzip the GraphApp.zip file again.
What about TURBO C? Turbo C probably won't work because it is an older compiler which pre-dates Windows.
Linker Error: Undefined symbol GETSAVEFILENAME in module DIALOGS
If COMMDLG.DLL is missing (which may be the case if you are using Windows 3.0) then you may have to download it and copy it into your WINDOWS\SYSTEM directory.
If compiling the GraphApp library yourself, you may have problems if you are using Borland C 3.0, since this version of the compiler didn't know about the COMMDLG functions. You will need to download the COMMDLG.H header file.
The COMMDLG.H and COMMDLG.DLL files can be downloaded from here: http://www.cs.su.oz.au/~loki/graphapp/download/commdlg.zip
If you still can't get the COMMDLG functions working, you may have to include the COMMDLG.LIB import library in your programs. This file is also included in the above mentioned zip file. This import library lists the functions which your compiler must know about so it can link to the COMMDLG.DLL at run-time.
Linker Error: Undefined symbol GETFILETITLE in module INIT
Linker Error: Missing function MAIN in module INIT
You should compile the graphapp.c file into a library, not an EXE. Check the "Librarian options" from the Options menu in your compiler, and read the help file. Find out how to create a library, instead of an EXE file.
If you have created the library, you can only run it by linking it to a program. Try making a project which contains graphapp.lib and pizza.c and then compile into an EXE. Remember to use the same memory model both when making the library, and also when making the EXE. Use 'Large' or '32-bit' as the memory model.
If you can't make a library, just put graphapp.c and pizza.c in one project, and compile that into an EXE.
If you mail Loki with a problem, understand that he may not be able to give you any advice unless you say exactly what the problem is. Write down the error messages, and record exactly what you did to produce the error. Include details of which compiler, version and operating system(s) you are using.