Thread overview | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 23, 2004 "count" defined behind the scenes, name conflict... | ||||
---|---|---|---|---|
| ||||
Not sure if this comes from DM, stlport, or what. I accidentally used a variable count, which I planned to, but forgot to declare, and got the worrisome error message below: sc main.cpp -cpp -Ae -Ar -r -mn -C -WA -S -3 -a8 -c -gf -D_DEBUG=1 -D_CONSOLE=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 -IG:\boost-1.30.2\boost -omain.obj Error: G:\BACNET\RS485\TEST\main.cpp(119): need explicit cast for function parameter 3 to get G:\BACNET\RS485\TEST\main.cpp(119): from: difference_typeiterator_traits<>(*C func)(_InputIter,_InputIter,const _Tp&) G:\BACNET\RS485\TEST\main.cpp(119): to : unsigned long * Lines Processed: 147315 Errors: 1 Warnings: 0 Build failed |
January 23, 2004 Re: "count" defined behind the scenes, name conflict... | ||||
---|---|---|---|---|
| ||||
Posted in reply to dan | And the offending code looks like?
dan wrote:
> Not sure if this comes from DM, stlport, or what. I accidentally used a variable count, which I planned to, but forgot to declare, and got the worrisome error message below:
>
> sc main.cpp -cpp -Ae -Ar -r -mn -C -WA -S -3 -a8 -c -gf -D_DEBUG=1
> -D_CONSOLE=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2
> -IG:\boost-1.30.2\boost -omain.obj
> Error: G:\BACNET\RS485\TEST\main.cpp(119): need explicit cast for function
> parameter 3 to get
> G:\BACNET\RS485\TEST\main.cpp(119): from:
> difference_typeiterator_traits<>(*C func)(_InputIter,_InputIter,const
> _Tp&)
> G:\BACNET\RS485\TEST\main.cpp(119): to : unsigned long *
> Lines Processed: 147315 Errors: 1 Warnings: 0
> Build failed
|
January 23, 2004 Re: "count" defined by something, not me | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Michel | In article <burnq9$vjj$1@digitaldaemon.com>, Scott Michel says... > >And the offending code looks like? //like this: #include <iostream> #include <tchar.h> #include <windows.h> #include <crtdbg.h> #include <string.h> .................... z.Read(b,10,&count); //where "count" is not defined (by me, anyhow). >> sc main.cpp -cpp -Ae -Ar -r -mn -C -WA -S -3 -a8 -c -gf -D_DEBUG=1 >> -D_CONSOLE=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2 >> -IG:\boost-1.30.2\boost -omain.obj >> Error: G:\BACNET\RS485\TEST\main.cpp(119): need explicit cast for function >> parameter 3 to get >> G:\BACNET\RS485\TEST\main.cpp(119): from: >//> difference_typeiterator_traits<>(*C func)(_InputIter,_InputIter,const >> _Tp&) >> G:\BACNET\RS485\TEST\main.cpp(119): to : unsigned long * >> Lines Processed: 147315 Errors: 1 Warnings: 0 >> Build failed > |
January 23, 2004 Re: "count" defined by something, not me | ||||
---|---|---|---|---|
| ||||
Posted in reply to dan | I understand your problem, but really, can you give a short example without the "...."'s? What is z's type, for example?
dan wrote:
> In article <burnq9$vjj$1@digitaldaemon.com>, Scott Michel says...
>>
>>And the offending code looks like?
>
> //like this:
>
> #include <iostream>
> #include <tchar.h>
> #include <windows.h>
> #include <crtdbg.h>
> #include <string.h>
>
> ....................
>
> z.Read(b,10,&count);
>
> //where "count" is not defined (by me, anyhow).
>
>>> sc main.cpp -cpp -Ae -Ar -r -mn -C -WA -S -3 -a8 -c -gf -D_DEBUG=1
>>> -D_CONSOLE=1 -IG:\dm\stlport\stlport -IG:\dm\include -IG:\boost-1.30.2
>>> -IG:\boost-1.30.2\boost -omain.obj
>>> Error: G:\BACNET\RS485\TEST\main.cpp(119): need explicit cast for
>>> function parameter 3 to get
>>> G:\BACNET\RS485\TEST\main.cpp(119): from:
>>//> difference_typeiterator_traits<>(*C func)(_InputIter,_InputIter,const
>>> _Tp&)
>>> G:\BACNET\RS485\TEST\main.cpp(119): to : unsigned long *
>>> Lines Processed: 147315 Errors: 1 Warnings: 0
>>> Build failed
>>
|
January 23, 2004 Re: "count" defined by something, not me | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Michel | In article <burplb$12kr$1@digitaldaemon.com>, Scott Michel says... > >I understand your problem, but really, can you give a short example without the "...."'s? What is z's type, for example? z's type is CSerial, and it's a big class for wrapping serial port communication; but I really don't think the problem comes from there, as that serial library is rather oldish and doesn't make use of stl, iterators or traits. My code is using std::pair<> and std::list<>; though I'm also using boost's MPL library; but the 'count' the error message refers to looks more stl'ish than boost'ish to me; though I've been wrong before... Besides, it's not like I'm saying "z.count"... just "count". I can send you a zip with all the sources if you like, but I don't think it would help. Seems to me one of the headers must be defining count in global space, (which seems crazy to me...). |
January 23, 2004 Re: "count" defined by something, not me | ||||
---|---|---|---|---|
| ||||
Posted in reply to dan | Actually, Dan, I don't fix compiler bugs, DigitalMars' Walter does that. (*)
What I was merely pointing out was that for this particular bug to get fixed, you might want to boil it down the simplest form of code possible. I was merely trying to nudge you in the right direction.
It also may just be that the error message is confusing or inappropriate. There may be another template whose third param is an unsigned long; in the absense of any other information, DMC++ is assuming that the closest matching template is the one whose third param is an unsigned long. That'd be my guess.
If the error message is actually confusing, then you'll still need a short example code snippet to demonstrate and propose a fix.
-scooter
(*) I wish I had access to the source to help with improving/fixing bugs and the IDDE. But Christmas isn't for another year.
dan wrote:
> In article <burplb$12kr$1@digitaldaemon.com>, Scott Michel says...
>>
>>I understand your problem, but really, can you give a short example without the "...."'s? What is z's type, for example?
>
> z's type is CSerial, and it's a big class for wrapping serial port
> communication; but I really don't think the problem comes from there, as
> that serial library is rather oldish and doesn't make use of stl,
> iterators or traits.
> My code is using std::pair<> and std::list<>; though I'm also using
> boost's MPL
> library; but the 'count' the error message refers to looks more stl'ish
> than
> boost'ish to me; though I've been wrong before...
>
> Besides, it's not like I'm saying "z.count"... just "count".
>
> I can send you a zip with all the sources if you like, but I don't think it would help. Seems to me one of the headers must be defining count in global space, (which seems crazy to me...).
|
January 24, 2004 Re: "count" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Scott Michel | >There may be another template whose third param is an unsigned long; in the absense of any other information, DMC++ is assuming that the closest matching template is the one whose third param is an unsigned long. That'd be my guess.
No, look at the message again: My function expected a pointer to an unsigned long, but I forgot to declare "unsigned long count". So, what would the compiler normally do? It would say "count not declared". *Instead*, it says that it cannot convert "count", in whatever screwey way it IS ALREADY DEFINED SOMEWHERE, to a pointer to an unsigned long.
But why should there be ANYTHING named "count"?!?!... especially in global space!!! Maybe "____COUNT____", but not "count"!!!
Cheers!
|
January 24, 2004 Re: "count" | ||||
---|---|---|---|---|
| ||||
Posted in reply to dan | dan wrote:
>>There may be another template whose third param is an unsigned long; in the
>>absense of any other information, DMC++ is assuming that the closest
>>matching template is the one whose third param is an unsigned long. That'd
>>be my guess.
>
>
> No, look at the message again: My function expected a pointer to an unsigned
> long, but I forgot to declare "unsigned long count". So, what would the
> compiler normally do? It would say "count not declared". *Instead*, it says
> that it cannot convert "count", in whatever screwey way it IS ALREADY DEFINED
> SOMEWHERE, to a pointer to an unsigned long.
>
> But why should there be ANYTHING named "count"?!?!... especially in global
> space!!! Maybe "____COUNT____", but not "count"!!!
>
> Cheers!
>
>
Are you sure you don't have "auto prototype" turned on?
Arjan
|
January 24, 2004 Re: "count" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Arjan Knepper | >Are you sure you don't have "auto prototype" turned on?
Don't even know what it is...
|
January 24, 2004 Re: "count" | ||||
---|---|---|---|---|
| ||||
Posted in reply to dan | dan wrote:
>>Are you sure you don't have "auto prototype" turned on?
>
>
> Don't even know what it is...
>
>
In the IDDE you are able to set the option for (C) function prototyping, a missing prototype will be automagically added on first use/call of the function.
IDDE: See project -> Setting -> Build-tab -> Prototype
CMDline -p-
Arjan
|
Copyright © 1999-2021 by the D Language Foundation