User forums > Using Code::Blocks

"Syntax Error" When Compiling zlib?

(1/2) > >>

kartari:
Hi,

  I'm trying to add libpng to my own project, and libpng requires zlib.  So I downloaded the zlib source, opened the MSVC++ project file with Code::Blocks, and get a "Syntax Error" on line 6 of the "win32\zlib1.rc" file when I compile either the dynamic or static library, debug or release.  The .rc file is as follows, with line 6 commented:


--- Code: ---#include <windows.h>

#ifdef GCC_WINDRES
VS_VERSION_INFO VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE     // Line 6: "syntax error"
#endif
  FILEVERSION 1,2,2,0
  PRODUCTVERSION 1,2,2,0
  FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
  FILEFLAGS 1
#else
  FILEFLAGS 0
#endif
  FILEOS VOS_DOS_WINDOWS32
  FILETYPE VFT_DLL
  FILESUBTYPE 0 // not used
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904E4"
    //language ID = U.S. English, char set = Windows, Multilingual
    BEGIN
      VALUE "FileDescription", "zlib data compression library\0"
      VALUE "FileVersion", "1.2.3\0"
      VALUE "InternalName", "zlib1.dll\0"
      VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
      VALUE "OriginalFilename", "zlib1.dll\0"
      VALUE "ProductName", "zlib\0"
      VALUE "ProductVersion", "1.2.3\0"
      VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
    END
  END
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x0409, 1252
  END
END

--- End code ---

  It's been a long time since I've dealt with .rc files, but this appears to be the correct syntax to me.  I'm guessing there's some kind of setting that's off, probably the MSVC++ project file was not imported 100% correctly.  What project settings should I be checking to ensure that C::B is in fact compiling this .rc file correctly?  I checked the platform field, which is set to "All" (Windows, Unix and Mac).  I tried setting it to Windows only and got the same result.  I would try the included MinGW makefile instead, but to be honest, I haven't dealt with makefiles since... the mid 90's. :)

  I'm using C::B 8.02 with the included GNU GCC compiler.  My development platform is Windows XP Pro, 32 bit.  I'm very new to C::B (I used MSVC++ in the past), and have been on a hiatus from coding for around four years and am starting to get back into it now, so please forgive any potential ignorance on my part. :)

  Thanks.

stahta01:
Did you try to define GCC_WINDRES ?

NOTE: This question really has little to do with Code::Blocks; so, it might end up being locked.

Edit: How to define Macro under Code::Blocks

1. Select project
2. "Project" -> "Build Options"
3. Select correct target, if you have no idea which target select the top one
4. Under "Compiler Settings" Tab
5. Under "#defines" sub tab
6 Add define in window

Edit2: Link to FAQ all beginners should turn on for full Compiler Log
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.

kartari:

--- Quote from: stahta01 on November 26, 2009, 03:24:58 pm ---Did you try to define GCC_WINDRES ?
--- End quote ---

I just tried it, and got the same syntax error.


--- Quote from: stahta01 on November 26, 2009, 03:24:58 pm ---NOTE: This question really has little to do with Code::Blocks; so, it might end up being locked.
--- End quote ---

Oh.  I guess I'll look for a gnu gcc or mingw forum if this gets locked, thanks for the heads up.  I figured it was a problem with the C::B project file and settings though, or maybe a windres issue specifically, despite receiving a "syntax error" during compilation, especially since zlib is a well known and well tested open source project which I'm pretty sure would not have a simple syntax error.  I think I'll do some Google research into windres settings and see if something's off with the command line arguments, perhaps ("windres.exe -i D:\DOCUME~1\B\SOFTWA~1\zlib123\win32\zlib1.rc -J rc -o Win32_LIB_Debug\win32\zlib1.res -O coff").


--- Quote from: stahta01 on November 26, 2009, 03:24:58 pm ---Edit2: Link to FAQ all beginners should turn on for full Compiler Log
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
--- End quote ---

Thanks Tim.

stahta01:
Some versions of windres can NOT do spaces or special characters.

Tim S.

kartari:

--- Quote from: stahta01 on November 26, 2009, 04:40:52 pm ---Some versions of windres can NOT do spaces or special characters.
--- End quote ---

So it might not like the tilde in my input file path... if that is so in my case, wouldn't it give me a "can't find the rc file" error instead of seeing the file and giving me a syntax error?  For the heck of it, I could try altering the command line to put the file name in quotes perhaps?  I can't seem to find where to enter command line arguments, however... the only way I know what the command line args are is from the build log.  Where can I change them?  Otherwise, I guess I'll have to try moving my Documents folder to fit 8.3 format, or move my project files out of my Documents and into a 8.3 compliant path...

Navigation

[0] Message Index

[#] Next page

Go to full version