Solved

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

Posted on 2002-05-06
16
843 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c++ how to tell if the progra is ctl or mfc atl ect 6 76
Dynamically allocate memory 9 58
Arduino EDI - Programming language 3 90
The line on IDE 4 84
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

813 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

10 Experts available now in Live!

Get 1:1 Help Now