views:

1088

answers:

3

Does anyone know how to make a macro or something to switch between foo.hpp and foo.cpp? I would really appreciate having a macro like this. I guess it would help if it actually opened the corresponding file, but kept the old one in a tab.

Thanks

+8  A: 

Perhaps one (or a combination) of the following will help you:

Daniel LeCheminant
I tested the 3rd suggestion in VS2008 and it works great. Thanks for the tip!
John Sibly
+2  A: 

Why not use right click > Go to declaration | Go to definition?

dirkgently
Because if it's a macro, you can assign a keyboard shortcut to it, and that can be executed anywhere in the file. To use Go to Definition, the cursor would need to be over the class name.
Andy
Doesn't that help (take you right where you want to go)? Curious.
dirkgently
You might be working with more than .cpp and .h files. I have 'generator' files that auto create-add .cpp/.h/.cs/.whatever to VS, it is handy to be able to jump among them.
Rodrigo Lopez
A: 

The solution provided in Switch between a Header and a CPP File in .NET (a macro at codeproject) works well in VS2003 and 2005 but for some reasons it does not work with VS2008 (on my computer).

The solution provided in Switch between Source and Header C++ Files (A recent macro from codeguru) works perfectly.

Thanks.