Solved

Visual C++ 6.0 Debugger can't handle CString variables

Posted on 2002-05-06
16
836 Views
Last Modified: 2013-12-14
Using Visual C++ 6.0 Enterprise Edition.
Working with DLL code, DEBUG compiled with NO optimizations, _UNICODE is defined, tools->options->debug->display unicode strings checked.

void MyClass::myFn()
{
  CString strName = _T( "Name" );
...
}

Debugger doesn't understand strName!

Variable window:
  Name column: blank
  Value column: CXX0004: Error: Syntax Error
Watch window:
  Name column: "strName"
  Value column: CXX0017: Error: symbol "strName" not found.

Newsgroups aren't very helpful. The only suggestion I've seen is to turn off optimization(not a factor here).

Thanks in advance.
0
Comment
Question by:shadow66
  • 7
  • 5
  • 3
  • +1
16 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 6991976
Do you have the MFC debug symbols installed (search for e.g. MFC*.pdb under your windows dir)? If not, that might explain the problem. You can install these symbols form the VC++ CD at any time. If you have, there might be a bigger problem...
0
 

Author Comment

by:shadow66
ID: 6992006
Yep. Also, as a test, I created a single document MFC app (with UNICODE enabled) on the same machine and verified the debugger is able to handle CStrings for that project. The problematic project contains a number of DLLs and the problem has been introduced in the last week or so. I was able to view string vars in the debugger in this very same project last week.
0
 
LVL 4

Expert Comment

by:mblat
ID: 6992016
just shot in dark - try to delete all *.ncb and *.opt files from your project....

it is like i said shot in a dark, but your problem seems to be project related...
0
 
LVL 86

Expert Comment

by:jkr
ID: 6992024
Hmmmm - if there are DLLs in the project that reference ANSI CStrings (and you are using UNICODE CStrings, if I get you right), there might be a problem in how the bugger handles such a duplicate in a symbol table - you may have notoced that there is e.g. a mfc42.pdb for the ANSI version of MFC and mfc42u.pdb for the UNICODE version...
0
 

Author Comment

by:shadow66
ID: 6992064
mblat - tried it and no change

jkr - both of those files exist in c:\winnt\system32, as well as others. The workspace contains ~25 projects; are you thinking one of them is missing _UNICODE in the list of preprocessor definitions (project settings)?
0
 
LVL 86

Expert Comment

by:jkr
ID: 6992077
Hmm, if you have the 'control' over all these projects, I'd better check it... BTW, just use the 'dependency walker' to see if any of these modules references an ANSI DLL (DW comes with VC++, but you can find updated versions on www.dependencywalker.com)
0
 

Author Comment

by:shadow66
ID: 6992169
jkr - great tool, thanks. According to Dependency Walker, some modules depends on MFC42UD.DLL, but none depend on MFC42.DLL.
0
 
LVL 4

Expert Comment

by:mblat
ID: 6992195
by any chance you're not mixing realese and debug versions of dll in your project?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:shadow66
ID: 6992246
That doesn't seem real likely, as debug versions of DLLs get copied to install-tree/bin/debug while release ones go to install-tree/bin/release; so the .exe in ../debug would only see the DLLs in that directory, and presumably they are all debug versions. However, I am going to clean the entire workspace and build it overnight to see if I get any relief.
0
 
LVL 22

Expert Comment

by:ambience
ID: 6993677
hey is there any goto or label around ? just asking !!
0
 
LVL 86

Expert Comment

by:jkr
ID: 6993902
0
 

Author Comment

by:shadow66
ID: 6994202
Problem seems to have been resolved by:
1. Exiting the IDE
2. Restarting the computer
3. Opening the IDE and workspace

My next step was going to be a full clean/rebuild, but it turned out to be unnecessary. I suppose the IDE entered an unstable state and got confused.

Thanks to all commenters. Mblat and jkr - I'd like to award you both 200 points you for your efforts. If one of you would please lock this question, I will score it "A". Then for the other of you I will post a 200 point-award question for you to get credit for your time as well.

0
 
LVL 4

Expert Comment

by:mblat
ID: 6994265
just wondering: what OS are you using?  
0
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
ID: 6994271
>>If one of you would please lock this question

OK, so I'll do it :o)
0
 

Author Comment

by:shadow66
ID: 6994572
Thanks again!
0
 

Author Comment

by:shadow66
ID: 6994582
Oops - Mblat I didn't notice your question. Win2K. Also, please lock the new question I've posted for you so I can award you points.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now