Re: Conversion from GCC C++ to Visual C++

From: Dranoel (Dranoel_at_discussions.microsoft.com)
Date: 07/28/04


Date: Wed, 28 Jul 2004 14:37:20 -0700


"Victor Bazarov" wrote:

> Dranoel wrote:
> > I have a project which has been built and executes under Linux (not sure which C++ compiler) and I have compiled every module without reported error under cygwin/gcc. However, under Visual C++ I get these types of compile errors, for example:
> > a. Compiling...xxx0.cpp
> > C:\...\Vector.h(58) : error C2065: 'value_type' : undeclared identifier
> > C:\...\Vector.h(58) : error C2143: syntax error : missing ';' before 'constant'
> > Error executing cl.exe.
> > on the statement in Vector.h:
> > void clear() { for (int i=0; i<n; i++) v[i] = (value_type)0; }
>
> So, I see 'value_type' used here. How is it declared/defined?
>
> > b. Compiling...xxx1.cpp
> > C:\...\Vector.h(58) : error C2065: 'value_type' : undeclared identifier
>
> The compiler apparently thinks that 'value_type' is undeclared. Do you
> have any proof the compiler is not correct?
>
> > C:\...\Vector.h(58) : error C2143: syntax error : missing ';' before 'constant'
> > C:\...\MiscVector.cpp(310) : error C2665: 'readPtSet' : none of the 2 overloads can convert parameter 2 from type 'class Array<class Vec2<float> >'
> > C:\...\MiscVector.cpp(381) : error C2784: 'template-parameter-1 __cdecl fabs(class Array<`template-parameter-1'>)' : could not deduce template argument for 'class Array<`template-parameter-1'>' from 'float'
> > C:\...\MiscVector.cpp(381) : error C2784: 'template-parameter-1 __cdecl fabs(class Array<`template-parameter-1'>)' : could not deduce template argument for 'class Array<`template-parameter-1'>' from 'float'
> > C:\...\MiscVector.cpp(610) : error C2784: 'template-parameter-1 __cdecl fabs(class Array<`template-parameter-1'>)' : could not deduce template argument for 'class Array<`template-parameter-1'>' from 'float'
> >
> > NOTE AGAIN: this all compiles fine under gcc.
>
> Of "all" you only presented a single line of code. It's impossible to
> make any judgement based on that.
>
> >
> > Can you give me a suggestion on where to go to resolve these type of problems;i.e, is compile under other C++ compilers but not Visual C++.
>
> Yes. Declare 'value_type' so that the compiler knows what it is. Or
> switch to the standard containers instead of your own, home-brewed ones.
> For example, you should probably use std::vector instead of 'Array'
> (whatever that is).
>
> V
>

Thanks, as a test, I had "corrected" a few of the easy ones. The examples were no more than that. The issue is that it compiles elsewhere but not under Visual C++. I could "correct" each reported error (with great difficulty I suspect), but I greatly prefer to determine what setup of Visual C++ will VC++ compatible with gcc. I am not the author of the software; I am charged with making the conversion with only necessary modifications. I am expressly forbidden to unilaterally "correct" errors not reported under more than one compiler.



Relevant Pages

  • Re: size of an integer ??
    ... It depends on the judgement of the implementer of the compiler, ... compiler for a "32-bit" system might have 16-bit int for compatibility ...
    (comp.lang.c)
  • Re: OpenSSH 4.2p1 Compression Problems
    ... >> It was compiled with Compaq's Tru64 C Compiler. ... > *GACK*. ... I suspect that's a big part of your problem. ... Good judgement comes with experience. ...
    (comp.security.ssh)
  • Re: Openssh 3.7p1 Solaris Compile
    ... Which compiler? ... sshd, and the case where /etc/default/login is missing. ... I also have another report of a SIGSEGV on Solaris 2.6 but we haven't ... Good judgement comes with experience. ...
    (SSH)
  • Re: OpenSSH 4.9p1 configure bug
    ... ld returned 1 exit status ... It appears that you compiler can't create executables with the flags you've supplied. ... I dunno what RHEL does in this regard. ... Good judgement comes with experience. ...
    (SSH)
  • Re: Form k = i + j and test for overflow.
    ... produce the same result as the unoptimized code even when the program ... expect a compiler to conform to. ... Illegal argument aliasing is a classic ... net | experience comes from bad judgement. ...
    (comp.lang.fortran)