21 Dec 04:16
Re: How to use #ifdef WIN32
Spencer Janssen <sjanssen <at> cse.unl.edu>
2007-12-21 03:16:21 GMT
2007-12-21 03:16:21 GMT
On Thursday 20 December 2007 18:37:15 Jim Burton wrote:
> I want to switch code on the OS but this always goes through to the #else
> (on windows or elsewhere):
>
> {-# OPTIONS -cpp #-}
> #ifdef WIN32
> main = putStrLn "hello windows"
> #else
> main = putStrLn "hello something else"
> #endif
>
> Does this depend on a Makefile setting WIN32, or should there be something
> predefined?
>
> Thanks,
If you're using Cabal, something like this should work:
if os(win32)
cpp-options: -DWIN32
Cheers,
Spencer Janssen
RSS Feed