Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - Problem with enums and preprocessor
Still trying to port libcurl, lots of enums ill give to shorten examples typedef enum { CURLOPT_NOTHING = 0, CURLOPT_FOO = 202 } CURLoption; This produces : ../include\curl/curl.h(684) : Error: 'CURLOPT_NOTHING' is already defined This is the only place CURLOPT_NOTHING is even mentioned I get the same results using a regular enum enum { CURLOPT_FOO = 202 } Whats up ? It also seems the preprocessor stumbles alot on the macros, we have this #define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number typedef enum { CURLOPT_NOTHING = 0, /* This is the FILE * or void * the regular output should be written to. */ CINIT(FILE, OBJECTPOINT, 1), /* The full URL to get/put */ CINIT(URL, OBJECTPOINT, 2), /* Port number to connect to, if other than default. */ CINIT(PORT, LONG, 3), /* Name of proxy to use. */ CINIT(PROXY, OBJECTPOINT, 4), ... So far I have had to change all these by hands ( or with a short script ) but Im wondering why this is not supported ? Thanks Charles Sep 20 2003
"Charles Sanders" <sanders-consulting comcast.net> wrote:#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number typedef enum { CURLOPT_NOTHING = 0, /* This is the FILE * or void * the regular output should be written to. */ CINIT(FILE, OBJECTPOINT, 1), /* The full URL to get/put */ CINIT(URL, OBJECTPOINT, 2), /* Port number to connect to, if other than default. */ CINIT(PORT, LONG, 3), /* Name of proxy to use. */ CINIT(PROXY, OBJECTPOINT, 4), ... So far I have had to change all these by hands ( or with a short script ) but Im wondering why this is not supported ? Sep 21 2003
"Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bkj5b0$jqe$1 digitaldaemon.com...Still trying to port libcurl, lots of enums ill give to shorten examples typedef enum { CURLOPT_NOTHING = 0, CURLOPT_FOO = 202 } CURLoption; This produces : ../include\curl/curl.h(684) : Error: 'CURLOPT_NOTHING' is already defined This is the only place CURLOPT_NOTHING is even mentioned Sep 21 2003
Odly, if i use a file with .cpp extension, the header problems go away. Ill try to build it forcing the compiler to use CPP. Thanks, C "Walter" <walter digitalmars.com> wrote in message news:bkkpt5$sr6$1 digitaldaemon.com..."Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bkj5b0$jqe$1 digitaldaemon.com...Still trying to port libcurl, lots of enums ill give to shorten examples typedef enum { CURLOPT_NOTHING = 0, CURLOPT_FOO = 202 } CURLoption; This produces : ../include\curl/curl.h(684) : Error: 'CURLOPT_NOTHING' is already Sep 22 2003
This unfortunately brings about other issues (using names like private, protected ), I tried just compiling the DLL with VC6 ( this is all to create D wrappers for libcurl ) using implib on the def file which works but I get runtime errors ( failed to initalize ). I hope SWIG gets completed soon (couldnt find an executable ). C "Charles Sanders" <sanders-consulting comcast.net> wrote in message news:bknr9o$2sgf$1 digitaldaemon.com...Odly, if i use a file with .cpp extension, the header problems go away. Sep 22 2003
|