Menu

from VC++ to DevC++

2005-10-26
2012-09-26
  • Nobody/Anonymous

    Hi , I only have the academic version of VC++ and since what started as a small homework got biger ( and better I hope ) I am trying now to move my project to DevC++ witch has a free compiler. To keep it short I have these problems when I try to compile zlib :

    errors :

    a) C:\zEngine\src\zlib\adler32.c `uLong adler32' redeclared as different kind of symbol

    b) C:\zEngine\include\zlib\zlib.h previous declaration of `uLong adler32(uLong, const Bytef*, uInt)'

    code :

    a) in adler32.c :

    uLong ZEXPORT adler32(adler, buf, len)
    uLong adler;
    const Bytef *buf;
    uInt len;
    {
    unsigned long s1 = adler & 0xffff;
    unsigned long s2 = (adler >> 16) & 0xffff;
    int k;

    if (buf == Z_NULL) return 1L;
    
    while (len > 0) {
        k = len < NMAX ? (int)len : NMAX;
        len -= k;
        while (k >= 16) {
            DO16(buf);
            buf += 16;
            k -= 16;
        }
        if (k != 0) do {
            s1 += *buf++;
            s2 += s1;
        } while (--k);
        MOD(s1);
        MOD(s2);
    }
    return (s2 << 16) | s1;
    

    }

    b) in zlib.h :

    ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));

    Other things to mention:
    -obove code compiles without any problems in VisualStudio 2003 and
    -I am useing DevC 4.9.9.2 .

    Any help to get out of this would be very appreciated. Thank you.

     
    • Nobody/Anonymous

      What libraries is your program specifically using?
      Under certain circumstances it may not be that feasible to switch from VC++ to DevC++. Also, your compilation issues sound specific to zlib (they have a mailing list, too).

      Also, some of the posted C code is either not correct or is using legacy parameter definitions, that MAY be interpreted as variable instantiations if you fail to pass the corresponding arguments to gcc. For example:


      uLong ZEXPORT adler32(adler, buf, len)
      uLong adler;
      const Bytef *buf;
      uInt len;
      {
      }


       
    • Nobody/Anonymous

      I grabbed the latest version of zlib and compiled it using MinGW via msys, and it worked, both using the configure script/makefile.in method and the makefile.gcc method in the win32 folder.

      That said, I'm really not sure if there's anything wrong with zlib. I recall compiling zlib a few months ago and it went very well too.

      Could you provide us with more details, such as your compile log? And how exactly are you compiling zlib?

      Benjamin Lau

      P/s It's good to have zlib compiled via the methods they have creeated for you. You can use the configure script which is a classical Unix way of doing things onlyy if you have a Unix shell. You can get one called msys from www.mingw.org. Either that, or you can use the makefile.gcc in the win32 folder, works like a charm.

       
    • Nobody/Anonymous

      I am useing the freeze version of zEngine http://zengine.sourceforge.net/
      and this lib has zlib included. I know that it is old but the project is 99% done and I do not want to switch to another lib for this one. So for some time I worked only in Visual C++ and it all compiled ok.
      I also do not understand :

      uLong ZEXPORT adler32(adler, buf, len)
      uLong adler;
      const Bytef *buf;
      uInt len;
      {
      }

      but it seams to be "eligible" for VC++ ...

      my comile log :

      Compiler: Default compiler
      Building Makefile: "C:\FUTURE\EngineSource\zEngine\devcpp\Makefile.win"
      Executing make...
      make.exe -f "C:\FUTURE\EngineSource\zEngine\devcpp\Makefile.win" all
      g++.exe -c ../src/zlib/adler32.c -o ../src/zlib/adler32.o -I"J:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"J:/Dev-Cpp/include/c++/3.4.2/backward" -I"J:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"J:/Dev-Cpp/include/c++/3.4.2" -I"J:/Dev-Cpp/include" -I"C:/FUTURE/EngineSource/zEngine/include" -I"C:/FUTURE/EngineSource/SDL_LIBS_DEV/include"

      ../src/zlib/adler32.c:47: error: `uLong adler32' redeclared as different kind of symbol

      C:/FUTURE/EngineSource/zEngine/include/zlib/zlib.h:1121: error: previous declaration of uLong adler32(uLong, const Bytef*, uInt)' ../src/zlib/adler32.c:47: error: declaration ofuLong adler32'
      C:/FUTURE/EngineSource/zEngine/include/zlib/zlib.h:1121: error: conflicts with previous declaration uLong adler32(uLong, const Bytef*, uInt)' ../src/zlib/adler32.c:47: error:adler' was not declared in this scope
      ../src/zlib/adler32.c:47: error: buf' was not declared in this scope ../src/zlib/adler32.c:47: error:len' was not declared in this scope
      ../src/zlib/adler32.c:48: error: initializer expression list treated as compound expression

      ../src/zlib/adler32.c:48: error: expected ,' or;' before "uLong"

      ../src/zlib/adler32.c:51: error: expected unqualified-id before '{' token

      ../src/zlib/adler32.c:51: error: expected ,' or;' before '{' token

      make.exe: *** [../src/zlib/adler32.o] Error 1

      Execution terminated

      this is my first time useing DevC and I am really lost in this errors

       
    • Nobody/Anonymous

      yes, as was said before, that's old-style C (K&R syntax), not really hard to understand, moreso hard to read. You will want to explicitly tell gcc to support this syntax.

      $man gcc

      Mike

       
    • Nobody/Anonymous

      if there is no option provided in devcpp, try to use --traditional as additional parameter for calling gcc.

       
    • Nobody/Anonymous

      nope, actually it should be:
      -traditional
      (just looked it up in the manpages)

      Also, please note that you can run scripts provided by the gcc project to "normalize" a source tree to current syntax (just in case). If anything else fails beyond this point, you should probably really take a look at the manpages, though. On the other hand, it may very well be much easier to simply use a current separate version of zlib.

      Mike

       
    • Nobody/Anonymous

      so what I did in "Project Properties" from DevC was:

      C compiler :
      1)attempt to support some aspects of traditional C :
      changed to YES ( it was NO )
      2)Support ANSI standard C programs : changed to YES ( it was NO )
      - if I make only these 2 changes I get no result but if

      I do this :

      C++ compiler :

      1)Accept $ in identifiers : changed to YES ( it was NO )

      after this I only get 1 error :

      cc1plus.exe C:\FUTURE\EngineSource\ zEngine\devcpp\cc1plus.exe unrecognized command line option "-fdollar-in-identifiers"

      C:\UTURE\EngineSource\zEngine\devcpp\Makefile.win [Build Error] [../src/zlib/adler32.o] Error 1

      any ideas of what to do next?

       Thanks
      
                  Alex
      
       
    • Nobody/Anonymous

      unset the "Accept $ in IDs" option, obviously this one isn't supported by your gcc version.

       
      • Paul van Zelst

        Paul van Zelst - 2005-10-27

        Who would want to use ugly identifier names like that anyway?

        double giveMeMo$Now();

        ... no, can't see a use for it :)

        Paul

         
    • Nobody/Anonymous

      Well. in BASIC we once had to use these, and in Perl/PHP we still have to. On the other hand it's definitely a good idea not to make use of any non-standard features.

      Mike

       
    • Nobody/Anonymous

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.