<html><div style='background-color:'><DIV class=RTE>
<P><BR><BR></P></DIV>
<DIV></DIV>>From: Maya <ESC...@NE...>
<DIV></DIV>>To: Dev-C++ Mailing List <DEV...@LI...>
<DIV></DIV>>Subject: [Dev-C++] MingWin or Cygwin
<DIV></DIV>>Date: Sun, 28 Dec 2003 15:02:50 -0800
<DIV></DIV><mailto:dev...@li...?subject=unsubscribe><mailto:dev...@li...><mailto:dev...@li...?subject=help><mailto:dev...@li...?subject=subscribe>
<DIV></DIV>
<P>>I am developing a program that gets compiled under two platformes, </P>
<DIV></DIV>>Linux and Windows. In MSW I use Dev-Cpp, which in turn uses MingWin,
<DIV></DIV>>a minimal GCC, but in Linux I use GCC; which is the complete version
<DIV></DIV>>of GCC. Now my problems is that there are certain C functions that
<DIV></DIV>>are incompatible with the two versions of the GCC package, one of
<DIV></DIV>>them is 'mkdir'. In MingWin the declaration is ' int mkdir(const
<DIV></DIV>>char*)' but in UNIX it is 'int mkdir(const char* , int). What can I
<DIV></DIV>>do to let know the compiler that if it is MingWin it should use one
<DIV></DIV>>incarnation of the function and visa versa?
<DIV></DIV>>Example:
<DIV></DIV>>#ifdef MINGWIN
<DIV></DIV>>... use mkdir("file.dat")
<DIV></DIV>>#endif
<DIV></DIV>>#ifdef CYWIN
<DIV></DIV>>... use mkdir("file.data", 0);
<DIV></DIV>>#endif
<DIV></DIV>>#ifdef __GCC__
<DIV></DIV>>...etc., etc.
<DIV></DIV>>#endif
<DIV></DIV>
<DIV>
<P>Hopefully, there aren't many functions you will have to do that with, but you can try something like this:</P></DIV>
<P>#ifdef WIN32</P>
<P>/*Meaning we are in Windows, mingwin, etc. */</P>
<P>#define MAKEDIR(X) mkdir(x)</P>
<P>#else</P>
<P>/*We are in Linux*/</P>
<P>#define MAKEDIR(X) mkdir(x,0)</P>
<P>#endif</mailto:dev...@li...?subject=subscribe></mailto:dev...@li...?subject=help></mailto:dev...@li...></mailto:dev...@li...?subject=unsubscribe></P>
<P>And, just use the macro in those specific cases. Or, you probably could use cygwin, and write the programs as though you were in Linux, just that you need to distribute it with the cygwin dll. Hope that helps.</P></div><br clear=all><hr>Add photos to your messages with <a href="http://g.msn.com/8HMBEN/2749??PS=">MSN 8. </a> Get 2 months FREE*.</html>
|