iostream,cons. app.,int main(){return 0;}, Won't link!

P

pyromedia

Anybody know why this does not link?

I have tried google 50 odd ways and nobody else seems to have this
problem
quite. It is meant to be a console application...

#include <iostream>
int main(){return 0;}

------ Build started: Project: HelloWorld, Configuration: Debug Win32
------
Compiling...
HelloWorld.cpp
Linking...
HelloWorld.obj : error LNK2019: unresolved external symbol "public:
__thiscall std::ios_base::Init::Init(void)"
(??0Init@ios_base@std@@QAE@XZ)
referenced in function "void __cdecl std::`dynamic initializer for
'_Ios_init''(void)" (??__E_Ios_init@std@@YAXXZ)
HelloWorld.obj : error LNK2019: unresolved external symbol "public:
__thiscall std::ios_base::Init::~Init(void)"
(??1Init@ios_base@std@@QAE@XZ)
referenced in function "void __cdecl std::`dynamic atexit destructor
for
'_Ios_init''(void)" (??__F_Ios_init@std@@YAXXZ)
C:\Documents and Settings\Kerewin\My Documents\Visual Studio
2005\Projects\HelloWorld\Debug\HelloWorld.exe : fatal error LNK1120: 2
unresolved externals
Build log was saved at "file://c:\Documents and Settings\KKere\My
Documents\Visual Studio
2005\Projects\HelloWorld\HelloWorld\Debug\BuildLog.htm"
HelloWorld - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

Points to note:
1. Strictly .NET 2005 C++ unmanaged.
2. Statically linking in LIBCPMTD.lib
3. Compiling with C++ exceptions enabled, /EHsc
4. XP Pro dev. environment.

Any ideas?

Oh, BTW http://comsc.dvc.edu/UsingVisualStudioNET05.pdf has a demo
which
apparently works... But not for me!
 
C

Carl Daniel [VC++ MVP]

Anybody know why this does not link?

Best guess - your VS2005 installation is messed up somehow. Have you tried
doing a repair install? What edition of VC++ 2005 are you using?

-cd
 
K

KKere

Hi Carl Daniel,

I know you are highly likely to be right because I did a complete
uninstall of all .NET material and MS applications that rely upon it -
about 9Gb.

Then I ran some registry checks, and EasyCleaner which found around
slight less than 2500 registry debris, mostly left by VS .NET 2005. eg
InProcServer CLSIDs, MRUs.

Finally, I reinstalled VS 2005 and tried out:

#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World"<<endl;
cin.get();
return 0;
}

This works along with the tiny snippet I have already put out into the
newsgroup. Unfortunately, ultimately, this has cost me >>40 hours and I
have in sequence conducted a 2K5 repair, a remove&reinstall, and now
finally what I stated above. Hum ho.

I am using final 2K5 Professional - Enterprise Architect is out of my
price range...

Thank you for your contribution.
kkere.
 
G

Guest

Hi Carl,
I m also having similar issue , but not in any simple console application.

What i m doing is , that i m migrationg my whole product from VC6 to VC8.
Even I have done it succesfully , but i have got stuck in one place where i
m using some third party LIB , to link with my projects.

I was using same Libraries with VC6.0.
But when I have used these libraries to link with me VC8 code it starts
giving me some issue.


Please help if there is nay solution.
regards , pardeep Kadian
 

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