Avatar of sniper423
sniper423Flag for United States of America

asked on 

"Member function not present" for all immediate window calls except my own class methods

When trying to debug a program in VS2005, all function/method calls in the immediate window result in the following error:

CXX0052:  Member function not present

The solution I build consists of 5 separate projects with dependencies established from the "start-up" project out to the others.  I am running a debug build with all optimizations disabled and with debug symbols loaded (or at least so says the project properties).  One other thing to note is that this is an MFC project, though I'm trying to maximize my use of compliant-C++ (i.e. standard library) wherever possible instead of using microsoft's "replacement" classes (e.g. CFile).  

Other solutions I've seen have been on the order of __declspec(noinline), but that won't work here, since my issue is being able to debug my use of the C++ standard library.

Here's an example:
//sample code
ifstream myFile;
myFile.open("myfile.dat", ios_base::in | ios_base::binary);
if (!myFile.is_open())
{
  ;  //yes, this is an empty statement...there's a breakpoint here
}

When the program breaks, I want to do things like this in the immediate window:
//here's how I would expect the immediate window to look:
myFile.is_open()  //call
false  //result
myFile.fail()  //call
true  //result
myFile.clear(ios_base::goodbit)  //call
//no return value

Any ideas?
Editors IDEsMicrosoft DevelopmentSystem Programming

Avatar of undefined
Last Comment
sniper423
Avatar of sniper423
sniper423
Flag of United States of America image

ASKER

Here are my includes as well, if it helps:

#include
using std::ifstream;
using std::ios_base;

#include
using std::setw;

Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

The most likely reason is because the functions are inline (if they are defined within the class body as most template code is then this is implicitly the case) and so the functions really don't actually exist in the compiled code.

I tested this theory and it seems to hold true...

[IMMEDIATE WINDOW OUTPUT]

t
{...}
t.outline_func()
2
t.inline_func()
CXX0052: Error: member function not present


Microsoft suggests option /Ob0 to force inlining off but I was not able to get it working with this option either.

Sorry, I can't help further.

#include <string>
 
struct test
{
	int inline_func() { return 1; }
	int outline_func();
};
 
int test::outline_func()
{
	return 2;
}
 
int main()
{
	test t;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sniper423
sniper423
Flag of United States of America image

ASKER

So it seems that the best way to go here would be to provide static wrappers for the  functions that I'd like to use, is that correct?
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

>> is that correct?
It's the only solution I managed to find for this problem, yes.
Avatar of sniper423
sniper423
Flag of United States of America image

ASKER

Thanks for your time and help.
Microsoft Development
Microsoft Development

Most development for the Microsoft platform is done utilizing the technologies supported by the.NET framework. Other development is done using Visual Basic for Applications (VBA) for programs like Access, Excel, Word and Outlook, with PowerShell for scripting, or with SQL for large databases.

48K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo