Notes on configuring custom tools (MS compilers)

Notes on configuring custom tools (MS compilers)

79
Advanced UserAdvanced User
79

    Nov 21, 2006#1

    I had a bit of a time getting the MS compilers configured on the Advanced tools menu to do quick-n-dirty compiles. I've seen several posts in this forum about getting compilers configured, with often no solid information given. So I figured I'd create this (rather long) post.

    I was surprised that there's no *specific* info on getting these compilers configured (even in the forums or the FAQ) - except for a power tip on getting the Java compiler configured. I know there's general info in the help files, but I had a fight getting UE to generate good commands that contained spaces and/or used special cmd operators.

    The command lines configured in the UltraEdit Advanced menu are initially passed to the UEDOS32.EXE program installed with UltraEdit.

    UEDOS32 performs some manipulation of the commandline (mostly mucking around with quotes), then passes this massaged command line to an instance of cmd.exe (using a "cmd /c" option to pass the command line to cdm.exe).

    Unfortunately, the changes UEDOS32 makes to the quotes make it very difficult to invoke a command using a path that contains spaces, so I had a hard time getting VC++ commands configured, since MS puts the compilers in directories that contains many spaces, and I hate using the short name variants (I don't like the '~'s and they aren't portable, since short filenames aren't deterministic).

    Another thing that complicates running the MS compilers is that they need to have vcvars32.bat (or vsvars32.bat) run to set up their environment. For the newer compilers, the path must be set correctly, as the compilers rely on DLLs that cannot be loaded otherwise (why aren't those DLLs in the same directory as the .exe's?). Since you essentially have to run 2 commands, you string them together using cmd.exe's '&&' operator. Unfortunately, UEDOS32 again does strange things with quotes around those characters if the command line starts with a quote...

    I guess I could have cobbled together some batch files to handle things, but it just seemed wrong that I would have to.

    Anyway, here's my info on getting various versions of MS VC++ configured in UltraEdit to compiler the current file. Maybe others can post info on other compilers (I've seen some forum inquiries):


    VC 7.1 (VS .NET 2003) (2 options shown):

    Code: Select all

    cmd /c ""C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat" &&  "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl"  "%f""
    If you remove the 'cmd /c' from the start, I would expect the command to still work - usually, UEDOS32 simply prepends the command with 'cmd /c'. However, if the command configured in UltraEdit starts with a quote, then UEDOS32 does strange things to the command line (in particular the quotes in the command line), so the 'cmd /c' at the start prevents the command line mangling from occurring.

    Code: Select all

    c:\Progra~1\MICROS~1.NET\Common7\Tools\vsvars32.bat  && c:\progra~1\MICROS~1.NET\vc7\bin\cl.exe "%f"

    This command gets around the quote problem by using short filenames in the paths I don't like it - for aesthetics and on principal - but it works... Note that you may need to change the 'MICROS~1.NET' to something else like 'MICROS~2.NET'. I had to on another machine.



    VC 6.0 (2 options shown):

    Code: Select all

    cmd /c ""c:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat" &&  "c:\Program Files\Microsoft Visual Studio\VC98\Bin\cl"  "%f""

    Code: Select all

    c:\Progra~1\Micros~3\VC98\Bin\vcvars32.bat &&  c:\Progra~1\Micros~3\VC98\Bin\cl  "%f"

    VC 8.0 (VS 2005):

    Code: Select all

    c:\Progra~1\MID05A~1\Common7\Tools\vsvars32.bat  && c:\progra~1\MID05A~1\vc\bin\cl.exe "%f"

    See what I mean about using the short filenames? "C:\Program Files\Microsoft Visual Studio 8" is "C:\Progra~1\MID05A~1" on my machine. I hate that.


    Finally, I add a custom tool to run programs that have compiled successfully:

    Code: Select all

    "%p%n.exe"

    Note: if you put a %p in the "Working directory" field (which is probably a good idea) *don't* put quotes around it.

    Note 2: you might want to put a %modify% in the command so UE32 will give you a chance to pass some parameters to the program.

    Now, I can compile quick-n-dirty programs and run them easily within UE32. Of course, for bigger projects that link together multiple modules, you'll want to have a custom tool that kicks off a makefile or move up to UE Studio, which is a pretty nice alternative to Visual Studio especially if you're working with non-MS compilers.