compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter _Grafenberger

    compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

    hi,

    i've some troubles compiling Bjarne Strostrup's Matrix class example



    under ms visual c++ 6.0 (sp4). i get a lot off errors like

    matrix_klasse_b y_stroustup.cxx (37) : error C2143: Syntaxfehler :
    Missing ';' before '<'

    for code like

    friend bool operator==<>(co nst Slice_iter& p, const Slice_iter& q);

    -- 60 errors in total --
    when i compile it on linux (with gcc 3.3) or on sgi everything is fine
    and with intel c++ (win) i get only 3 errors for redefining a variable
    (which seems to be right?!) and after removing this it is also fine.

    do i miss a compiler flag or is there a general problem with ms vc++
    6.0 (and if so is it also present in version 7.0)

    kind regards

    peter

    ------------------------------------------------------------------------
    p.s: compiler flags:

    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 /nologo /subsystem:conso le /incremental:no
    /pdb:"Release/simple_tests.pd b" /machine:I386
    /out:"Release/simple_tests.ex e"
  • Victor Bazarov

    #2
    Re: compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

    "Peter _Grafenberger" <peter.grafenbe rger@vatech-hydro.at> wrote...[color=blue]
    > i've some troubles compiling Bjarne Strostrup's Matrix class example
    > [...]
    > do i miss a compiler flag or is there a general problem with ms vc++
    > 6.0 (and if so is it also present in version 7.0)[/color]

    This is a PERFECT question to ask in microsoft.publi c.vc.language.
    Please post any compiler-specific questions to a newsgroup for that
    compiler.

    Victor


    Comment

    • stephan beal

      #3
      Re: compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

      Ron Natalie wrote:[color=blue]
      > Don't call it matrix.c. Most C++ compilers will treat files that end in
      > .c as the C language.[/color]

      Actually, he didn't name it *.c:
      matrix_klasse_b y_stroustup.cxx (37) : error C2143: Syntaxfehler :
      Missing ';' before '<'


      --
      ----- stephan beal
      Registered Linux User #71917 http://counter.li.org
      I speak for myself, not my employer. Contents may
      be hot. Slippery when wet. Reading disclaimers makes
      you go blind. Writing them is worse. You have been Warned.

      Comment

      • Kevin Saff

        #4
        Re: compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0


        "Peter _Grafenberger" <peter.grafenbe rger@vatech-hydro.at> wrote in message
        news:48dc857d.0 307220718.56847 ed4@posting.goo gle.com...[color=blue]
        >
        > friend bool operator==<>(co nst Slice_iter& p, const Slice_iter& q);
        >
        > -- 60 errors in total --
        > when i compile it on linux (with gcc 3.3) or on sgi everything is fine
        > and with intel c++ (win) i get only 3 errors for redefining a variable
        > (which seems to be right?!) and after removing this it is also fine.
        >
        > do i miss a compiler flag or is there a general problem with ms vc++
        > 6.0 (and if so is it also present in version 7.0)[/color]

        MSVC6 is notoriously bad at template code. Off the top of my head, partial
        specialization and template member functions are both not supported, and
        complicated templates tend to increase the likelihood of an internal
        compiler error. I haven't used 7, so I don't know if it works any better.
        I recommend using anything other than 6 if you have any choice in the
        matter.


        Comment

        • Keith A. Lewis

          #5
          Re: compile Bjarne Stoustrup's Matrix example under MS Visual C++ 6.0

          In article <48dc857d.03072 20718.56847ed4@ posting.google. com>,
          Peter _Grafenberger <peter.grafenbe rger@vatech-hydro.at> wrote:[color=blue]
          >hi,
          >
          >i've some troubles compiling Bjarne Strostrup's Matrix class example
          >
          >http://www.research.att.com/~bs/matrix.c
          >
          >under ms visual c++ 6.0 (sp4). i get a lot off errors like
          >
          >matrix_klasse_ by_stroustup.cx x(37) : error C2143: Syntaxfehler :
          >Missing ';' before '<'
          >
          >for code like
          >
          >friend bool operator==<>(co nst Slice_iter& p, const Slice_iter& q);[/color]

          Remove the "<>"'s on the various operator members, fix the for
          scoping issues, and this compiles and appears to execute just fine
          under VC++6.0 and VC++7.0. (Modulo compiler whine level.)

          Before I get flamed for mentioning compiler specific matters, is
          this really the correct friend declaration? What were the design
          decisions behind not using something like

          template<> friend operator==(cons t Slice_iter& p, const Slice_iter& q);

          instead? I'm sure Stroustrup is right, but it just looks wrong.
          Some idiot (ok, me) might think that there is a C++ operator called
          "==<>", instead of realizing that operator== is a template function.

          Comment

          Working...