Screen snapshots are included to give you an idea of what your computer should look like after you have completed certain steps. The descriptions are complete without the images, but you may wish to use Netscape in the computer lab if your www browser does not support GIF images.
You are allowed to move your files to the subdirectory labelled c:\docs on lab computers. Doing so will make things work much faster, but be careful. Don't forget to save your work on your floppy when you are done since you may lose it if someone else erases it (e.g., the system administrator cleans the drive). You should delete your work from this subdirectory to keep the computers clean and to prevent someone else from copying your work.
EXETYPE WINDOWS CODE PRELOAD MOVEABLE DISCARDABLE DATA PRELOAD MOVEABLE MULTIPLE HEAPSIZE 1000 STACKSIZE 45000
Save this file on the floppy disk if you are in the computer lab, or in the same subdirectory as crr.cpp otherwise. It is not important that you know what this code means.
Here is a snapshot of the toolbar and the main window at this point.
Here is a rough idea of what you should see at this point.
Click OK once again.
Here is a snapshot of what you should see in your project window after having completed these steps.
You should see a lot of activity and hear writing to the
floppy drive or the hard drive, depending on where your source
code is located. This may take a while. If there are no errors,
a dialog box indicating "Success" should
appear. Click OK. Now click the icon with the
lightning bolt and the description Make and run current program.
Here is what this button
looks like:
The CRR option pricing program should appear in a window. To stop the program, enter a negative stock price and close the window.
You may have too many applications open when trying to start the compiler. The compiler is somewhat of a memory hog, so you might want to make it the only open application. If everything is closed but Turbo C++ yet you still get this message, you may need to exit and restart Windows to refresh the system resources. If this does not work and you are on a lab computer, check with a lab assistant. If you are on your own computer, check to make sure you that you have allocated sufficient virtual memory; consult your MS-DOS/Windows computer manuals. If this is not the problem, read the computer manuals on "Making more memory available" or consult someone in the computer lab.
Undefined symbol (...) in library file C:\TCWIN\LIB\owlwi.lib in module winmain
You may not have selected EasyWin[.exe] in step 5. The EasyWin feature of Turbo C++ allows you to construct a Windows executable without knowing how Windows actually works. The selection Application[.exe] assumes instead that you have written a complete Windows application (with with message handlers and the like). This is something we will not do in class.
No module definition file specified: using defaults.
You may not have correctly typed crr.def in step 2 or did not add it to the project in step 6. Check these steps if you have not changed anything in the original code.
If you have changed the code, then the variable MAXTERNODES may be too large. Memory allocated for arrays linked to this variable may exceed the 64K stack + heap + data group memory allocation allowed by a 16-bit compiler and straight-forward memory management. Try reducing MAXTERNODES to 3000 or so. If you have added new arrays of size MAXTERNODES, you may need to divide 3000 by the number of arrays. If you have a real need to access more memory, check out the "Which Compiler Should I Use" link. I have documentation on a advanced method which mitigates this problem in Turbo C++, but it is not recommended.
Undefined symbol crr::eurcall(...) in module crrtest
The file crr.cpp may not have been properly added to the project in Step 6. If the symbol main() is undefined, you may not have added crrtest.cpp. It is also possible that you are using an undefined variable or a function which has not been prototyped. This error might also arise from not having renamed the *.cc files to *.cpp files.
Be sure you have initialized all variables which need to be initialized.
You may have incorrectly added crr.h in step 7. This step creates the dependence of crrtest.cpp and crr.cpp on crr.h.
A mistake in this step is not typically fatal to creating an application, but
it can produce unintended results. This error comes about because of an
important feature in the "make" utility, which allows the compiler to
recompile and link only what is necessary to update a program.
This can save hours (or days!) of compilation time in complex programs.
However, it is your responsibility to properly identify dependence among files
in the IDE. You may notice that you can force the compiler to recompile
everything by selecting the icon with the file and the description
Rebuild all files
,
but you should learn how to set up the IDE correctly. Failing to do so
can produce programs which give wrong answers in critical situations, even
though you have written correct source code!
Linker fatal: crr.def syntax error
You may have mistyped something in crr.def.
There are several potential problems. First, Turbo C++ 4.5 is likely to be slow when you have 4MB or less of RAM. Try minimizing the number of applications which are open at the same time. Be aware that there may be ``hidden'' programs, such as device drivers, which are run when you boot the computer. You may have to disable some of these to get more memory. Second, using the floppy drive slows things down a lot. Consider using the hard drive instead, but be careful if you are in the lab. Third, you might need to defragment your hard drive, especially if you haven't done so in a while. (Don't do this in the computer lab.) The problem is that Turbo C++ takes up quite a bit of space on the hard drive, and files can get so fragmented that the computer spends a lot of time moving to the files' locations. (I learned this the hard way.) Defragmenting with the /f option helps to solve this problem. See me if your computer complains that it does not have sufficient memory to do the defragmentation.
Experiment if you cannot find your error here; this is a good way to learn a programming language. If you get hopelessly confused, don't be afraid to delete all but the original files and redo everything. (This happens very often in programming!)
You may also experiment with the Turbo Debugger. The debugger gives you the ability to stop the program at specified locations to examine the values of the variables, among many other things. I do not generally use the debugger, but you may find it useful.
If you are hopelessly stuck, please describe your problem as much as possible and e-mail
There are other editors available to you, some of which provide support for programmers. For example, I prefer to use a clone of the UNIX vi editor called Vim. Using a program called ctags and Vim together, I can instantly move from function to function in C++ source code, even across multiple files. Vim has over 52 buffers for containing copied or deleted text and provides for immediate access to the MS-DOS command line. It allows you to write up to 26 macros and an unlimited number of abbreviations.
The most important feature your compiler must have is the ability to save a document as pure text with no added symbols. MS-Works, MS-Word for Windows or DOS, and WordPerfect are examples of editors which you should avoid for writing C++ code. If you do decide to use such an editor, be sure to save the your work as a text file. Test the editor with small changes to make sure that it does not add symbols to your C++ code when you save files. It is extremely unlikely that your programs will compile if you save your work as anything but a text file.
To open files for editing in Turbo C++, double-click on the file in the project window. For example, I have opened crrtest.cc and crr.cc on my computer; here is a snapshot:
Enter your changes in the appropriate window. It is generally a good idea to save your files before recompiling or running the program in case your operating system crashes, but Turbo C++ will usually save backups if you do not.