Solved

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

Posted on 2002-05-06
16
852 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

738 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