what gives? cstring template issues

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

    what gives? cstring template issues

    In VS 2003, I try creating a new VC7 MFC dll. Accepting all defaults,
    before adding ANY code, I get compiler errors out the wazoo having to
    do with this CString template. I ran across the same problem in
    porting some code over and compiling with the /clr switch and I
    resolved that issue by modifying a section of code that was typecasting
    a byte to a string (AFTER about a half-day of figuring out the right
    compiler options, and then realizing I needed to change them for EVERY
    SINGLE SOURCE FILE in the project, which I managed to accomplish with
    find/replace in notepad, but only AFTER dancing through hoops). But my
    current errors must be in the default project settings, or somewhere
    ??!! Because I haven't written a single line of source yet.

    IJW my AS$ !

    TIA

  • Bruno van Dooren

    #2
    Re: what gives? cstring template issues

    I just added a new MFC dll project to a VS2003 solution, accepted the
    defaults (no automation, no sockets, using MFC in a shared dll).
    everything builds without a problem.
    No CString errors or anything.

    did you modify your environment or project settings, or anything else?
    what are the compiler errors you get?

    kind regards,
    Bruno.


    "dotnetchic " <dotnetchic@gma il.com> wrote in message
    news:1138993195 .927354.15760@z 14g2000cwz.goog legroups.com...[color=blue]
    > In VS 2003, I try creating a new VC7 MFC dll. Accepting all defaults,
    > before adding ANY code, I get compiler errors out the wazoo having to
    > do with this CString template. I ran across the same problem in
    > porting some code over and compiling with the /clr switch and I
    > resolved that issue by modifying a section of code that was typecasting
    > a byte to a string (AFTER about a half-day of figuring out the right
    > compiler options, and then realizing I needed to change them for EVERY
    > SINGLE SOURCE FILE in the project, which I managed to accomplish with
    > find/replace in notepad, but only AFTER dancing through hoops). But my
    > current errors must be in the default project settings, or somewhere
    > ??!! Because I haven't written a single line of source yet.
    >
    > IJW my AS$ !
    >
    > TIA
    >[/color]


    Comment

    • dotnetchic

      #3
      Re: what gives? cstring template issues

      Following the same steps you describe, I get the rather cryptic output
      message (several similar):

      c:\Program Files\Microsoft Visual Studio .NET
      2003\Vc7\atlmfc \include\cstrin gt.h(868) : error C2143: syntax error :
      missing ';' before 'template'

      along with many of the following compiler errors (mostly syntax
      errors):
      C2146, C2252, C2252, C2501, C2653, C2334,
      which all revolve around compilation of stdafx.cpp. I haven't changed
      any project settings, and nothing looks out of line... ?

      Comment

      • dotnetchic

        #4
        Re: what gives? cstring template issues

        Has anyone else had this problem with cstrings / templates? Any
        suggestion what I might can try? I'm trying to bring a new project
        over to vc++7, or preferrably c#, but I can't seem to make any progress.

        Comment

        • Bruno van Dooren

          #5
          Re: what gives? cstring template issues

          Hi,
          "dotnetchic " <dotnetchic@gma il.com> wrote in message
          news:1139328379 .653558.77520@g 14g2000cwa.goog legroups.com...[color=blue]
          > Has anyone else had this problem with cstrings / templates? Any
          > suggestion what I might can try? I'm trying to bring a new project
          > over to vc++7, or preferrably c#, but I can't seem to make any progress.[/color]

          Could you prehaps post a project that reproduces this behavior?
          If you have this problem with a newly created project, then compiling it on
          my side should quickly show if the problem is in your project or your
          environment.

          --

          Kind regards,
          Bruno.
          bruno_nos_pam_v an_dooren@hotma il.com
          Remove only "_nos_pam"


          Comment

          • dotnetchic

            #6
            Re: what gives? cstring template issues

            Of course! Many thanks for taking a look. I'll send to your e-mail.

            -SLC

            Comment

            • dotnetchic

              #7
              Re: what gives? cstring template issues

              my lib and include paths are the same as yours above. I am unable to
              compare your build log against mine, though...can you send to my e-mail?

              Comment

              • Arnaud Debaene

                #8
                Re: what gives? cstring template issues

                dotnetchic wrote:[color=blue]
                > my lib and include paths are the same as yours above. I am unable to
                > compare your build log against mine, though...can you send to my
                > e-mail?[/color]

                Have you modified the cstringt.h header? Post a snippet of this file around
                line 868.

                Arnaud
                MVP - VC


                Comment

                • dotnetchic

                  #9
                  Re: what gives? cstring template issues

                  To my knowledge, cstringt.h has not been modified (at least not by
                  yours truly). See anything unusual?


                  #ifndef _MANAGED

                  This template will compile only for
                  class SystemString == System::String

                  template<class SystemString>
                  CStringT( SystemString * pString ) :
                  CThisSimpleStri ng( StringTraits::G etDefaultManage r() )
                  {
                  const wchar_t __pin* psz = PtrToStringChar s( pString );
                  *this = psz;
                  }
                  #endif

                  Comment

                  • Bruno van Dooren

                    #10
                    Re: what gives? cstring template issues

                    Hi,
                    [color=blue]
                    > #ifndef _MANAGED[/color]
                    in my header, this is #ifdef, not #ifndef
                    [color=blue]
                    > This template will compile only for
                    > class SystemString == System::String[/color]
                    the // comment characters are missing at the start of these 2 lines.

                    judging by this, your headers are different from what they should be.
                    In one of your previous posts, you mentioned that you had to manually edit a
                    lot of files.
                    maybe you accidently edited the header?

                    I don't know if there is a good way to repair the headers or not.
                    if you have to do it by hand, the simplest thing might be to just reinstall
                    VS.

                    --

                    Kind regards,
                    Bruno.
                    bruno_nos_pam_v an_dooren@hotma il.com
                    Remove only "_nos_pam"


                    Comment

                    • dotnetchic

                      #11
                      Re: what gives? cstring template issues

                      Right. The comments are kinda suspicious, huh?

                      Actually, I had to manually change the BasicRuntimeChe cks settings for
                      each file included in the project, and ended up manually editing the
                      project file. So my editing was isolated to the one file, not
                      affecting any headers.

                      I just changed the directive and everything compiled. Hmmm... Note to
                      self: keep the boss out of the source files!!

                      Well, thanks for your help. At least I'm back to square 1 with my code
                      port. Cheers!

                      Comment

                      Working...