By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,365 Members | 3,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,365 IT Pros & Developers. It's quick & easy.

Help with <iostream.h> and Linker errors

P: n/a
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?
Mar 2 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Chris Jones wrote:
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
Mar 2 '06 #2

P: n/a
Thanks, problem fixed.

"David Wilkinson" wrote:
Chris Jones wrote:
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

Mar 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.