I would like to read a file inside of a CIN.  I am using Microsoft
Visual C++ IDE.

To start off with, I compiled the mult.vi example included in the
Using External Code manual.  This successfully generates a mult.lsb
file that can be imported.

>From there I attempted to include fstream.h or iostream.h, both of
which result in the error: "eh.h is only for C++!"

Come to find out, Microsoft Visual C++ determines whether the code is
C, or C++, based on the extension.
(ref http://www.louisville.edu/~ecrouc01/CECS302/VisualCPP.htm)

I know that the file is .c, not .cpp, but in an attempt to get the
file and console functions to work I:
 - Delete mult.c from the project
 - Change the file extension from mult.c to mult.cpp
 - (Re)Import the new mult.cpp into the project
 - Attempt a compile.

The result is:

--------------------Configuration: mult - Win32
Debug--------------------
Compiling...
mult.cpp
Linking...
   Creating library mult___Win32_Debug/mult.lib and object
   mult___Win32_Debug/mult.exp
cin.obj : error LNK2001: unresolved external symbol _CINRun
mult___Win32_Debug/mult.dll : fatal error LNK1120: 1 unresolved
externals
Error executing link.exe.

mult.dll - 2 error(s), 0 warning(s)
----------------------------------------------------------------------------------------

So I tried to back out of this and found that a repeat of the above
extension renaming process, back to the .c extension, does me no good.
I get the above errors when compiling regardless.

I have no idea how to back out of what was changed, other than to
delete the project and start over from scratch (not a small task
considering all the options that have to be set).

I also have no idea how to use functions that would let me read a file
or stream to the console (cin, cout, etc), not that I would expect to
be able to do these necessarily, but I can't even include the .h file
with compiler errors.  All of the tutorials I have seen use these as
the most basic functions, yet they won't run.

Any help or understanding of the above problems is appreciated.

Reply via email to