views:

181

answers:

2

Can anyone list the specific and detailed steps to configure mc.exe (the message compiler) to compile a .mc file into a .rc file as a custom compiler step in VC++ 2010?
I am really lost on how to do this.

+1  A: 

Right-click the project, Add + New Item, select Text File, name it Blah.mc. Enter or paste the definitions. Right-click Blah.mc, Properties, Custom build step:

  • Command line = mc $(InputPath)
  • Outputs = $(InputName).rc

Edit your .rc file, add:

#include "Blah.rc"

Worked for me, ought to be close.

Hans Passant
Prgress, but did you mean: Command line = mc $(InputName).mc Outputs = $(InputName).rc; $(InputName).h Regardless, this gives the error: mc : error : 0x2 trying to open file <.mc>.
EMS
OK, I am starting to think there is a bigger problem. I make a TextFile.txt, then configured: Command line = echo "InputDir=" $(InputDir) "InputName=" $(InputName) >TextOut.txt Outputs = TextOut.txt TextOut.txt does not contain the $(xxx) macro expansions. Does not look right.
EMS
Not sure what you are doing. Make sure the filename extension is .mc, not .txt
Hans Passant
Thanks for your help. Macro names $(InputName), $(InputPath) are blank for me in the custom build step. "mc.exe" fails, claiming no args. In the above "echo" test, I try to echo the macro expensions to a file, but also come up blank there too. Could this be a bug?
EMS
There's more than one Custom Build Step. Did you follow my instructions? *Right-click the .mc file* in the Solution Explorer window.
Hans Passant
A: 

If you want to use a Custom Build Rule, you can do this

  • Right click your project in Visual Studio -> Custom Build Rules
  • Click "New Rule File" and fill out the fields, I use this rule file for MC.EXE

    
    
      
        
          
            
            
            
          
        
      
    
tonto