Macro to compile a file set (cpp/h)

T

Torben Laursen

Hi

Is it possible to write a macro that compiles a file set (cpp/h).
I can find it on the menu if I right click on a cpp file but it would be
nice to just have a
macro that I could call using a shortcut.

Can anyone show me what that macro should look like?

Thanks Torben
 
D

David Lowndes

Is it possible to write a macro that compiles a file set (cpp/h).
I can find it on the menu if I right click on a cpp file but it would be
nice to just have a
macro that I could call using a shortcut.

In VS the normal mapped keystroke for the compile menu option (for
C/C++) is Ctrl+F7.

Dave
 
T

Torben Laursen

Thanks Dave, I did not see that one.

But it only works if I select the file in the solution explorer and only if
I select the .cpp file.

Isn't there a way to compile if I am in the editor for eigther the .h or
..cpp file?

Torben
 
D

David Lowndes

Isn't there a way to compile if I am in the editor for eigther the .h or
.cpp file?

It should work if you're currently editing the cpp file - it always
has for me.

Dave
 
D

David Wilkinson

Torben said:
Thanks Dave, I did not see that one.

But it only works if I select the file in the solution explorer and only
if I select the .cpp file.

Isn't there a way to compile if I am in the editor for eigther the .h or
.cpp file?

Torben:

I'm not sure that this is a realistic goal. Not all code is organized
into .h/.cpp pairs.

There is an old add-in that switches between the .h and .cpp files (if
any), or it can be done with Visual Assist. That is what I do.

I also add the Compile command to my build toolbar (next to the build
project button). The button is dimmed if the current file is not an
implementation file.
 
T

Torben Laursen

Ctrl+F7 works fine in a .cpp file, sorry my mistake.

I have a macro to switch between .cpp and .h.
What I was looking for was a general method to compile a file or file set
just like in C++ builder 6.0
When I worked in that compiler I jused it a lot to check my code for syntax
errors.

Torben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top