Well, does it mean that I can't get this thing going? :( Or is there a way of making it work? I looked into that header, and it does not contain anything that significant. Just a couple of so of includes and defines.
Thanks
Zeato
Printable View
Well, does it mean that I can't get this thing going? :( Or is there a way of making it work? I looked into that header, and it does not contain anything that significant. Just a couple of so of includes and defines.
Thanks
Zeato
Also, there is no such file as "stream.h".
The problem is that you are using non-standard, compiler-specific header files. You cannot port an application to another compiler if you are using such headers.
Regards,
Paul McKenzie
Sure there is a way to make it work -- figure out what those headers are supposed to be doing, and rewrite them to be portable, get rid of them if they are irrelevant, or rewrite them in terms of the compiler that you are porting to.Quote:
Originally Posted by dr_zeato
Regards,
Paul McKenzie
Another one: "rusage.h".
Again, porting to another compiler, unless the code is standard C or C++, could take hours, days, or weeks depending on the application and the non-standard functions that the application calls.
Having the code "guarantee to compile on UNIX" means nothing when attempting to compile it for Windows, unless the code uses standard library functions and headers, which your application certainly does not.
Regards,
Paul McKenzie
Paul,
I have not written this code, instead I just downloaded it from the web to use it. The readme file says that it is compilable with GNU C++ compiler g++.
I should say that it was all very confusing as I have never worked with any compiler other than Borland C and VC++. At least one thing I realize now that this code can't be ported to VC++.
Thanks for your time and comments.
Zeato
Get the free Bloodshed (Dev-C++) development package. It uses GNU C++ as the base compiler (www.bloodshed.net).
Regards,
Paul McKenzie
I don't get why certain compilers use non-standard stuff. And what about the cpp files corresponding to these headers, if there are any? I think they won't be available to the users unless it is open source.Quote:
Originally Posted by Paul McKenzie
Zeato
Paul,Quote:
Originally Posted by Paul McKenzie
Thanks for the tip. I would definitely try it out.
Zeato
Hi,
I am trying to port unix code to windows using VC++ 6.0.
I have been able to somehow compile the code. The problem is now that I am getting some linker errors which I don't know why. Following is a list of some of those errors:
In addition I am also getting the following warnings:Code:TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ofstream::ofstream(void)" (__imp_??0ofstream@@QAE@XZ)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ofstream::`vbase destructor'(void)" (__imp_??_Dofstream@@QAEXXZ)
Decision.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ofstream::`vbase destructor'(void)" (__imp_??_Dofstream@@QAEXXZ)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class ostream & __thiscall ostream::operator<<(char)" (__imp_??6ostream@@QAEAAV0@D@Z)
Decision2.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class ostream & __thiscall ostream::operator<<(char)" (__imp_??6ostream@@QAEAAV0@D@Z)
Decision.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class ostream & __thiscall ostream::operator<<(char)" (__imp_??6ostream@@QAEAAV0@D@Z)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class ostream_withassign cerr" (__imp_?cerr@@3Vostream_withassign@@A)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class filebuf * __thiscall ofstream::rdbuf(void)const " (__imp_?rdbuf@ofstream@@QBEPAVfilebuf@@XZ)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ofstream::open(char const *,int,int)" (__imp_?open@ofstream@@QAEXPBDHH@Z)
TimerU.obj : error LNK2001: unresolved external symbol _getrusage
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall ios::precision(int)" (__imp_?precision@ios@@QAEHH@Z)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall ios::width(int)" (__imp_?width@ios@@QAEHH@Z)
TimerU.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall ofstream::close(void)" (__imp_?close@ofstream@@QAEXXZ)
GMClass.obj : error LNK2001: unresolved external symbol __imp__fprintf
GMClass.obj : error LNK2001: unresolved external symbol __imp__system
GMClass.obj : error LNK2001: unresolved external symbol __imp__freopen
GMClass.obj : error LNK2001: unresolved external symbol __imp__fgetc
Could someone plz help me out?Code:LINK : warning LNK4049: locally defined symbol "_exit" imported
LINK : warning LNK4049: locally defined symbol "_strtok" imported
LINK : warning LNK4049: locally defined symbol "_fgets" imported
LINK : warning LNK4049: locally defined symbol "_strstr" imported
Thanks
Zeato
Any thoughts folks?
Zeato
Well, what are your link settings? It looks like you're not linking in a C runtime library.
Viggy
I have defaults except that I added libc.lib. Following is the complete list:
ThanksQuote:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LIBC.LIB
Zeato
Hmm, mine are the same. It does look like you've got all the LIB files listed twice. However, that wouldn't be why your link is failing.
Are you using a Microsoft compiler? What version? LIBC.LIB is a release mode CRT, for single threaded apps. If you're compiling in debug mode, this library will not work. Also, this library would automatically be linked in, if you compile with the /ML command line option.
Here's a link to the CRT libraries. Incidentally, 'libc.lib' is not shipped with Dev Studio 7.x (.NET).
Viggy
Hi,
It appears that it is something that is more complicated than that. I tried compiling it in release build with no success. Same is the case with removing libc.lib altogether (note that I do have /ML option).
I have never experienced such a problem and as you can see the problem is with the very basic functions like fprintf, fgetc, etc. Also, if you notice, linker has something prepended to the function names e.g., __imp__fgetc.
Any suggestions?
Zeato
What compiler are you using?
Viggy