Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: compilation errors

Reply
Thread Tools

Re: compilation errors

 
 
John Harrison
Guest
Posts: n/a
 
      07-23-2003

"seia0106" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> while writing an application with MS-DirctX9, i had following
> compilaiton errors. Despite much effort i could not get rid of these
> error messages. Would someone please help me and tell me about the
> cause of these error messages and how to correct them. thanks
>
> ************************************************** ********************
> Creating library Debug_Unicode/ball.lib and object
> Debug_Unicode/ball.exp
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: __thiscall ifstream::ifstream(void)"
> (__imp_??0ifstream@@QAE@XZ)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: void __thiscall ifstream::`vbase
> destructor'(void)" (__imp_??_Difstream@@QAEXXZ)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: __thiscall ios:perator void
> *(void)const " (__imp_??Bios@@QBEPAXXZ)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: class istream & __thiscall
> istream::getline(unsigned char *,int,char)"
> (__imp_?getline@istream@@QAEAAV1@PAEHD@Z)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: void __thiscall ifstream:pen(char
> const *,int,int)" (__imp_?open@ifstream@@QAEXPBDHH@Z)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: static int const filebuf:penprot"
> (__imp_?openprot@filebuf@@2HB)
> ftxtstrm.obj : error LNK2001: unresolved external symbol
> "__declspec(dllimport) public: void __thiscall ifstream::close(void)"
> (__imp_?close@ifstream@@QAEXXZ)
> .\Debug_Unicode\ball.ax : fatal error LNK1120: 7 unresolved externals
> Error executing link.exe.


They aren't compiler errors, they are linker errors. The cause of these
errors is that you haven't linked with the correct library, in other words
your project settings are wrong. To me it looks like you are using
Microsoft's obsolete iostream library, and trying to import it from a DLL.
Are you including a header file <iostream.h>? If so you should replace this
with

#include <iostream> // note no .h
using namespace std;

That will get you the modern iostream library. If that doesn't help then ask
on a VC++ newsgroup (for instance news:microsoft.public.vc.language) linker
errors are compiler specific and so are off topic in a language group, like
comp.lang.c++.

john


 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      07-23-2003
> Are you including a header file <iostream.h>? If so you should replace
this
> with
>
> #include <iostream> // note no .h
> using namespace std;
>


I should say also replace

#include <fstream.h>

with

#include <fstream> // note no .h
using namespace std;

and similarly for any other iostream type header files. You get the picture.

john


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation error with seperate compilation C__chp C++ 4 02-15-2008 03:57 PM
Dynamic compilation errors Steve ASP .Net 2 10-23-2004 05:39 PM
Newbie needs help with perl compilation errors Alfred B. Stansbury Perl 1 10-22-2004 10:55 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
compilation errors Eqbal VHDL 0 11-18-2003 08:07 PM



Advertisments