Help with <iostream.h> and Linker errors

G

Guest

I am using the old <iostream.h>. When I compile a simple test program that
uses <iostream.h>, Visual C++ 7 gives me this strange error:

Compiling...
capp.cpp
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29) :
warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma
deprecated
Linking...
LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
Debug/Test.exe : fatal error LNK1120: 1 unresolved externals

I did some digging and found out the <iostream.h> was far outdated.
Therefore, I include the new iostream, <iostream>, but then the compiler says
that cout and cin (the only iostream commands I used) were not defined. How
can I use cout and cin without getting a compiler (or linker) error?
 
D

David Wilkinson

Chris said:
I am using the old <iostream.h>. When I compile a simple test program that
uses <iostream.h>, Visual C++ 7 gives me this strange error:

Compiling...
capp.cpp
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include\useoldio.h(29) :
warning C4995: '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma
deprecated
Linking...
LIBCMTD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
Debug/Test.exe : fatal error LNK1120: 1 unresolved externals

I did some digging and found out the <iostream.h> was far outdated.
Therefore, I include the new iostream, <iostream>, but then the compiler says
that cout and cin (the only iostream commands I used) were not defined. How
can I use cout and cin without getting a compiler (or linker) error?

Chris::

std::cin, std::cout, std::endl

Or you can use

using namespace std;

But don't put it in a header.

David Wilkinson
 
G

Guest

Thanks, problem fixed.

David Wilkinson said:
Chris::

std::cin, std::cout, std::endl

Or you can use

using namespace std;

But don't put it in a header.

David Wilkinson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top