One thing I noticed was that the CD install puts around 40MB of help files on the hard-drive and leaves include files and the libraries on the CD. I deleted all the help files from my hard-drive and copied the include and lib subdirectories to the hard-drive. This saves about 32MB of hard-drive space and means that you will have to access the CD less during compilation (a good thing). This will make your help files inaccessible from the IDDE, but you can run them from the CD by double-clicking on them.
If you have further problems with the installation, check the ``Getting Started Guide'' included with the CD. It has a detailed troubleshooting section. If you need further assistance, please contact me.
General Note: I am not sure whether the homework problems can be compiled easily into a Windows (3.x,NT,95) program. My intuition is that they cannot because our programs do not have code which tells it how to interact with the Windows operating system. The ``EasyWin'' feature in Turbo C++ adds this extra code, so the executable compiled there is indeed a full-fledged Windows program. At this time, I do not know if Symantec C++ has a similar feature.
Note to Windows 95 users: I am almost certain (and have been told) that the instructions below will work for you; you only need to access the DOS command line. My understanding is that you can do this directly in Windows 95 or you can reboot in DOS mode. Please let me know if you have problems.
Screen snapshots are included to give you an idea of what you should see at various steps. The descriptions are complete without the 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.
sc crrtest.cpp -mx -c -ocrrtest.obj sc crr.cpp -mx -c -ocrr.obj sc -mx crrtest.obj crr.obj -ocrrtest.exeThe first two commands compile crrtest.cpp and crr.cpp without linking them. (This is what the -c option tells us.) The output is placed in files crrtest.obj and crr.obj. The -mx option compiles in DOS extender code (discussed below). The third command links the object files and the DOS extender. The name of the executable will be crrtest.exe .
Here is a snapshot of my screen after I have entered these commands.
crrtest.exeat the DOS prompt. Enter a negative stock price when you are finished.
INTERRUPT 0CH, STACK FAULT error code = 0000 eax = 00000000 esi=7E4B567F flags = 0286 ds = 00CF . . . . . . . . . . . .
The problem is that, even though you are compiling in 32-bit mode, the memory requirements of the program exceed the default amount of memory allocated to it.
One solution is to allocate more memory. To do this, use your favorite text editor to add the following lines to crrtest.cpp between the statement which includes iostream.h and crr.h.
//The following lines set the stack size to 200KB. // #include <dos.h> unsigned _stack = 204800; //It is important to use the underscore in "_stack". Also notice that this portion of code is most likely nonportable since it includes the header file dos.h.
Here is a snapshot of my editor in which I have highlighted the new code.
The reason that this works is because we have compiled and linked in the DOS extender code by using the option -mx above. This code enables the program to access all available extended memory (up to 4 gigabytes) if you have an extended memory manager or the amount of available conventional memory otherwise (up to 640KB). The small amount of extra code we must enter tells the program to allocate 200KB. You can set this much higher if you wish, but you are limited to the amount of RAM plus virtual memory on your computer.
The DOS extender also places the processor in protected mode, which gives you some crash protection. For more information, search for DOSX in the Symantec C++ online help.
I have a project, crr.prj, opened, and it has the three files in it, but they do not appear to be organized in any particular way. I played around with the "heirarchy" feature trying to organize files in the same way you did, but was unable to figure out the function.
SC automatically recognizes the dependence of crrtest.cpp and crr.cpp on crr.h. Turbo C++ (TC) should but doesn't, so that is why it is important in TC but not here. In the IDDE in SC, you should have crrtest.cpp and crr.cpp in the "Project" window, and the compiler will insert crr.h itself later.
I tried to compile the group of three files (actually four with crr.def)...
You do not need to write the crr.def file for the SC IDDE since it writes one for you. The maximum stacksize is set during the linking stage for DOS or DOSX programs.
I got an error in a file called crrtest.obj which said
Symbol Undefined __acrtused_winc
You most likely have the IDDE set so that it compiles some type of Windows executuable (Win 3.x, Win32, or Win 95). You will probably need to set it to compile a DOS or a DOSX executable. This is an option you have when you set up the project, or you can change it under Project...Settings. The reason is that a Windows program needs more information than we give it. For instance, the program must know how to interpret a mouse click or a command to paint a resized window. This is difficult and off-topic, so it is best to just compile as DOS or DOSX. There may be a feature in SC which lets you compile a generic program into a Windows program (by automatically inserting the appropriate code), but I don't know of it.