#### Archived

This topic is now archived and is closed to further replies.

# Visual Studio classview and enum parameters

## Recommended Posts

AlSun    122
This is something that's bugged me for a while, since I have a few functions that use an enum in the parameters they accept. When you double click on the function name in ClassView, Visual Studio pops up a dialog saying it can't find the definition (implementation) of the function. This only seems to happen for functions that use an enum in their parameter list. It doesn't seem to matter how you write the function, as you can see from this source:
// Test.h

class CTest
{
public:
enum Enum1
{
OPTION1_1,
OPTION1_2,
OPTION1_3
};
void function0(int param);
void function1(Enum1 param);
void function2(CTest::Enum1 param);
void function3(enum CTest::Enum1 param);
};
// Test.cpp

#include "Test.h"
#include <windows.h>

void CTest::function0(int param)
{
}

void CTest::function1(Enum1 param)
{
}

void CTest::function2(CTest::Enum1 param)
{
}

void CTest::function3(enum CTest::Enum1 param)
{
}

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
CTest test;
test.function0(100);
test.function1(CTest::OPTION1_1);
test.function2(CTest::Enum1::OPTION1_2);
test.function3(CTest::Enum1::OPTION1_3);
return 0;
}
This compiles perfectly, but only when you double click function0 in the ClassView do you get to the function definition. The other three functions pop up the error dialog instead. I've used Visual Studio 6, and Visual C++ .Net standard edition, and they both exhibit the same behaviour. Does anyone know how to get this to work, or whether it's a definite limitation that you just have to live with? (Edited to change source spacing) [edited by - AlSun on May 26, 2004 10:34:10 AM]