Magick.mod won't compile

BlitzMax Forums/Brucey's Modules/Magick.mod won't compile

nuno(Posted 2015) [#1]
Hello guys,

I downloaded the lastest version of Brucey's Magick module and the lastest version of minGW.
But I'm getting stuck with a compiling error:


Compiling:jp2.c
In file included from C:/BlitzMax/mod/bah.mod/magick.mod/src/coders/jp2.c:39:0:
C:/BlitzMax/mod/bah.mod/magick.mod/src/magick/studio.h:329:40: error: expected ';', ',' or ')' before numeric constant
# define sleep(seconds) sleep(seconds*1000)
^
C:/BlitzMax/mod/bah.mod/magick.mod/src/magick/studio.h:329:39: error: expected ';', ',' or ')' before '*' token
# define sleep(seconds) sleep(seconds*1000)
^
Build Error: failed to compile C:/BlitzMax/mod/bah.mod/magick.mod/src/coders/jp2.c
Process complete



My specs:
-------------
BlitzMax Release Version 1.50

FASM version: 1.69.14
GCC version: 4.8.1
G++ version: 4.8.1
------------

I've tried to comment the "Sleep(seconds*1000)", also to use a "\" before it to define a new line, among others things... But nothing worked.

If I delete the file (jp2.c), it pass through, but get a error at compiling the C:/BlitzMax/mod/bah.mod/magick.mod/source.bmx. Though I think in this case it's only a matter of delete the references to jp2.c in the source.bmx file...
BUT I need jp2, because it's the JPEG 2000 format and I need to load this format into my program...

Someone knows what to do here?
I don't understand much of C/C++, so I don't know how to fix this "# define sleep(seconds) sleep(seconds*1000)" error...

Note: The software has to use the Magick module, because it can load .DPX... it can't be the Freeimage, sadly :(
Unless there's another solution out there for DPX loading in BlitzMax (does it??)


grable(Posted 2015) [#2]
That is an odd one. It seems like something not a value gets passed as an argument, yet its only used in 3 places in the entire codebase (and all look correct at a glance).

Commenting out the whole line at least compiles, so if the features you use doesnt require correct timing it would probably be enough.

EDIT: Or replace the whole line with the line below, which should do the same.
static inline void sleep(int seconds) { Sleep(seconds * 1000); }



nuno(Posted 2015) [#3]
Thank you, grable!

I ended up uninstalling it all (BlitzMax and MinGW) before I saw your answer :(

For now, what I did worked:

- Uninstalled BlitzMax and MinGW, also deleting both folders from disk
- Installed a fresh BlitzMax
- Installed MinGW, but instead of the most recent official version, I used the tdm-gcc-4.7.1-2, wich Brucey recommends for his modules.
- Added paths to system variables
- Copied the ar.exe and ld.exe from MinGW to BlitzMax\bin folder
- Copied all the files from MinGW\lib to BlitzMax\lib
- Copied mods to Bmax folders
- Rebuilt all modules

It rebuilt them all without errors (it showed only BZIP pragma messages).

Now I'll start using the libraries, to see if there's something wrong with these compilings...
I have already some questions regarding Magick library, but I'll create another topic for this.

Thank you for your help, grable. I'll keep this post updated with my progress


grable(Posted 2015) [#4]
No problem :)

Its a bit weird for it to fail like that though, and I cant find any reason for it.
I did find out that mingw implements its own sleep() in unistd.h though, so that may be why it compiles even if its commented out.