trace1 can't be compile?

My enviormentis Vc6.0, in a project, i add trace1 for output ,but compile
error?? why??

error C2065: 'LL' : undeclared identifier


0
lynhoo (7)
11/6/2003 9:05:50 AM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
949 Views

Similar Articles

[PageSpeed] 32

Probably because the name is TRACE1, not trace1
				joe

On Thu, 6 Nov 2003 17:05:50 +0800, "lynhoo" <lynhoo@sina.com.cn> wrote:

>My enviormentis Vc6.0, in a project, i add trace1 for output ,but compile
>error?? why??
>
>error C2065: 'LL' : undeclared identifier
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/6/2003 3:32:56 PM
Thanks your reply!

My source line is :

TRACE1(_T("***
ERROR[cdxCSizingDialog::ControlInfo::Header::StretchWindow()]:
GetWindowPlacement() failed for dialog with caption \"%s\" !\n"),(LPCSTR)s);

but I can't compile it, the error like this:

error C2065: 'LL' : undeclared identifier
error C2143: syntax error : missing ')' before 'string'
error C2059: syntax error : ')'


"Joseph M. Newcomer" <newcomer@flounder.com> д����Ϣ����
:gcqkqvok4sv84kknvcjitr9bsbkkmn7sqi@4ax.com...
> Probably because the name is TRACE1, not trace1
> joe
>
> On Thu, 6 Nov 2003 17:05:50 +0800, "lynhoo" <lynhoo@sina.com.cn> wrote:
>
> >My enviormentis Vc6.0, in a project, i add trace1 for output ,but compile
> >error?? why??
> >
> >error C2065: 'LL' : undeclared identifier
> >
>
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm


0
lynhoo (7)
11/7/2003 1:02:17 AM
I've find it, my corporate has redefine the trace macro!

Thank Joseph M. Newcomer

"lynhoo" <lynhoo@sina.com.cn> д����Ϣ����
:Olk0vpMpDHA.1488@TK2MSFTNGP12.phx.gbl...
> Thanks your reply!
>
> My source line is :
>
> TRACE1(_T("***
> ERROR[cdxCSizingDialog::ControlInfo::Header::StretchWindow()]:
> GetWindowPlacement() failed for dialog with caption \"%s\"
!\n"),(LPCSTR)s);
>
> but I can't compile it, the error like this:
>
> error C2065: 'LL' : undeclared identifier
> error C2143: syntax error : missing ')' before 'string'
> error C2059: syntax error : ')'
>
>
> "Joseph M. Newcomer" <newcomer@flounder.com> д����Ϣ����
> :gcqkqvok4sv84kknvcjitr9bsbkkmn7sqi@4ax.com...
> > Probably because the name is TRACE1, not trace1
> > joe
> >
> > On Thu, 6 Nov 2003 17:05:50 +0800, "lynhoo" <lynhoo@sina.com.cn> wrote:
> >
> > >My enviormentis Vc6.0, in a project, i add trace1 for output ,but
compile
> > >error?? why??
> > >
> > >error C2065: 'LL' : undeclared identifier
> > >
> >
> > Joseph M. Newcomer [MVP]
> > email: newcomer@flounder.com
> > Web: http://www.flounder.com
> > MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>


0
lynhoo (7)
11/7/2003 1:15:57 AM
I notice that although you have written Unicode-aware code in one place (using _T() ) you
have cast the string s to an LPCSTR instead of an LPCTSTR

Note that if you look at the definition of TRACE1 in afx.h (line 235 in my VS6 source),
there is nothing that can induce this error. Show me the line that precedes this TRACE1,
since one guess is that you are getting an error based on some earlier line inducing the
error.

When you get problems like this, one way to see what is happening is to manually add the
/P (it is case-sensitive!) switch to your command line and recompile. What will happen is
that the preprocessed output will be written as a .i file. It will be huge. But you can
then go in and locate the actual source, as seen by the compiler, and see what is being
generated. Search for the string you are writing, or a piece of it, otherwise you might
have to page through 50K-100K lines of header file expansions, which gets real dull. Then
look backward from that point for something containing LL.
						joe

On Fri, 7 Nov 2003 09:02:17 +0800, "lynhoo" <lynhoo@sina.com.cn> wrote:

>Thanks your reply!
>
>My source line is :
>
>TRACE1(_T("***
>ERROR[cdxCSizingDialog::ControlInfo::Header::StretchWindow()]:
>GetWindowPlacement() failed for dialog with caption \"%s\" !\n"),(LPCSTR)s);
>
>but I can't compile it, the error like this:
>
>error C2065: 'LL' : undeclared identifier
>error C2143: syntax error : missing ')' before 'string'
>error C2059: syntax error : ')'
>
>
>"Joseph M. Newcomer" <newcomer@flounder.com> д����Ϣ����
>:gcqkqvok4sv84kknvcjitr9bsbkkmn7sqi@4ax.com...
>> Probably because the name is TRACE1, not trace1
>> joe
>>
>> On Thu, 6 Nov 2003 17:05:50 +0800, "lynhoo" <lynhoo@sina.com.cn> wrote:
>>
>> >My enviormentis Vc6.0, in a project, i add trace1 for output ,but compile
>> >error?? why??
>> >
>> >error C2065: 'LL' : undeclared identifier
>> >
>>
>> Joseph M. Newcomer [MVP]
>> email: newcomer@flounder.com
>> Web: http://www.flounder.com
>> MVP Tips: http://www.flounder.com/mvp_tips.htm
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
11/7/2003 1:46:08 AM
Just use TRACE. TRACE1, TRACE2, etc are deprecated. TRACE supports any
number of arguments. In VC7 it also allows to specify special values as its
first arguments: message class, etc. Those new facilities are not documented
well, though.

"lynhoo" <lynhoo@sina.com.cn> wrote in message
news:%23cLEZxMpDHA.424@TK2MSFTNGP10.phx.gbl...
> I've find it, my corporate has redefine the trace macro!
>
> Thank Joseph M. Newcomer
>
> "lynhoo" <lynhoo@sina.com.cn> д����Ϣ����
> :Olk0vpMpDHA.1488@TK2MSFTNGP12.phx.gbl...
> > Thanks your reply!
> >
> > My source line is :
> >
> > TRACE1(_T("***
> > ERROR[cdxCSizingDialog::ControlInfo::Header::StretchWindow()]:
> > GetWindowPlacement() failed for dialog with caption \"%s\"
> !\n"),(LPCSTR)s);
> >
> > but I can't compile it, the error like this:
> >
> > error C2065: 'LL' : undeclared identifier
> > error C2143: syntax error : missing ')' before 'string'
> > error C2059: syntax error : ')'
> >
> >
> > "Joseph M. Newcomer" <newcomer@flounder.com> д����Ϣ����
> > :gcqkqvok4sv84kknvcjitr9bsbkkmn7sqi@4ax.com...
> > > Probably because the name is TRACE1, not trace1
> > > joe
> > >
> > > On Thu, 6 Nov 2003 17:05:50 +0800, "lynhoo" <lynhoo@sina.com.cn>
wrote:
> > >
> > > >My enviormentis Vc6.0, in a project, i add trace1 for output ,but
> compile
> > > >error?? why??
> > > >
> > > >error C2065: 'LL' : undeclared identifier
> > > >
> > >
> > > Joseph M. Newcomer [MVP]
> > > email: newcomer@flounder.com
> > > Web: http://www.flounder.com
> > > MVP Tips: http://www.flounder.com/mvp_tips.htm
> >
> >
>
>


0
alegr (1131)
11/7/2003 5:10:12 AM
Thank you, Alexander Grigoriev
you remind me, I am compiling it using unicode,
so when decompile the macro, the problem occurs.

Change
TRACE1(_T("***
ERROR[cdxCSizingDialog::ControlInfo::Header::RestoreWindowPosition()]:
GetWindowPlacement() failed for dialog with caption \"%s\"
!\n"),(LPCSTR)(LPCTSTR)s);
to
TRACE1("***
ERROR[cdxCSizingDialog::ControlInfo::Header::RestoreWindowPosition()]:
GetWindowPlacement() failed for dialog with caption \"%s\"
!\n",(LPCSTR)(LPCTSTR)s);

is ok!!
Thanks again.


0
lynhoo (7)
11/7/2003 7:18:53 AM
Please NEVER cast from LPCTSTR to LPCSTR and vice versa. Use LPCTSTR cast
only when you pass a CString to a variadic argument function. You'll save
you from many errors. Use as few typecasts as possible.

"lynhoo" <lynhoo@sina.com.cn> wrote in message
news:%23$WBd8PpDHA.2584@TK2MSFTNGP09.phx.gbl...
> Thank you, Alexander Grigoriev
> you remind me, I am compiling it using unicode,
> so when decompile the macro, the problem occurs.
>
> Change
> TRACE1(_T("***
> ERROR[cdxCSizingDialog::ControlInfo::Header::RestoreWindowPosition()]:
> GetWindowPlacement() failed for dialog with caption \"%s\"
> !\n"),(LPCSTR)(LPCTSTR)s);
> to
> TRACE1("***
> ERROR[cdxCSizingDialog::ControlInfo::Header::RestoreWindowPosition()]:
> GetWindowPlacement() failed for dialog with caption \"%s\"
> !\n",(LPCSTR)(LPCTSTR)s);
>
> is ok!!
> Thanks again.
>
>


0
alegr (1131)
11/8/2003 4:44:31 AM
Reply:

Similar Artilces: