[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VC++ 6.0 : Porting Issue ( Porting C++ application from Linux to Windows)

Posted on 2006-05-15
5
Medium Priority
?
502 Views
Last Modified: 2013-12-14
Hello C++ Experts,

We have a compilation error while porting our application from Linux to Windows . Following are the details of the same.

Compiler : VC++ 6.0
OS          : Windows - XP

Error       :
"When compiling applications with MSVC++ and C++ exception handling:
  Replace any 'catch( ... )' with 'PtW32CatchAll' in POSIX threads
  if you want POSIX thread cancelation and pthread_exit to work.
c:\program files\microsoft visual studio\vc98\include\ios.h(103) : error C2371: 'streambuf' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(255) : see declaration of 'streambuf'
c:\program files\microsoft visual studio\vc98\include\ios.h(104) : error C2371: 'ostream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(257) : see declaration of 'ostream'
c:\program files\microsoft visual studio\vc98\include\ios.h(106) : error C2371: 'ios' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(254) : see declaration of 'ios'
c:\program files\microsoft visual studio\vc98\include\istream.h(64) : error C2371: 'istream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(256) : see declaration of 'istream'
c:\program files\microsoft visual studio\vc98\include\iostream.h(66) : error C2371: 'iostream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(258) : see declaration of 'iostream'
c:\program files\microsoft visual studio\vc98\include\fstream.h(59) : error C2371: 'filebuf' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(267) : see declaration of 'filebuf'
c:\program files\microsoft visual studio\vc98\include\fstream.h(98) : error C2371: 'ifstream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(268) : see declaration of 'ifstream'
c:\program files\microsoft visual studio\vc98\include\fstream.h(118) : error C2371: 'ofstream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(269) : see declaration of 'ofstream'
c:\program files\microsoft visual studio\vc98\include\fstream.h(138) : error C2371: 'fstream' : redefinition; different basic types
        c:\program files\microsoft visual studio\vc98\include\iosfwd(270) : see declaration of 'fstream'"


Could you please help me out in resolving this .

Thanks in advance
~Kalyan
0
Comment
Question by:k_kalyan
  • 3
  • 2
5 Comments
 
LVL 30

Accepted Solution

by:
Axter earned 375 total points
ID: 16682442
>>c:\program files\microsoft visual studio\vc98\include\ios.h(103) : error C2371: 'streambuf' : redefinition; different basic types

Looks like it's mixing standard STL code with non-standard STL code.

You should avoid using non-standard STL code entirely.
The non-standard STL code is the one that uses *.h extension like the following:
#include <iostream.h>
#include <fstream.h>
#include <vector.h>

The above headers are not part of the C++ standard.
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16682476
The problem is that you're mixing standard C++ library headers and old iostream headers. More info on this page :

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvc/html/msdn_stlfaq.asp

(scroll down to : "I am receiving compiler error "C2371: 'identifier' redefinition; different basic types". What is causing this?")
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16682485
Oops, Axter was faster, and clearer :)
0
 
LVL 30

Expert Comment

by:Axter
ID: 16682502
Continue....

If you mix non-standard headers, as in my above comment, with standard headers, and add the using namespace std, your compiler will get a redifinition error.

To avoid this, don't use non-standard headers.
If you have to use non-standard headers, don't use "using namespace std"

If you have to use "using namespace std", never use it in a header file.
0
 
LVL 30

Expert Comment

by:Axter
ID: 16822146
k_kalyan,
Why the B grade?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question