Zeus IDE Forum Index Zeus IDE
Use this forum to ask for help, submit a bug report or make a suggestion.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using Zeus with Microsoft Tools

 
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks
View previous topic :: View next topic  
Author Message
jussij
Site Admin


Joined: 13 Aug 2004
Posts: 2205

PostPosted: Thu Sep 10, 2009 7:07 am    Post subject: Using Zeus with Microsoft Tools Reply with quote

NOTE: The ze.cmd batch file referenced in this posting now comes as part of the installation.

Microsoft tools generally require a fair amount of configuration when it comes to setting up environment variables etc.

This can make it difficult to use these tools from with-in Zeus, that is until now Smile

Here the two steps required to configure Zeus to run the Microsoft C# compiler.

Note: The same approach should also work for the Microsoft C/C++ compiler.

Step 1: Create a Simple Batch File

The vsvars32.bat file is batch provided by Microsoft to correctly setup all the required environment variables.

All we need to do is create batch file that runs the vsvars32.bat file before running Zeus.

To do this just copy the code shown below and use it to create the C:\Program Files\Zeus\ze.cmd batch file:
Code:
@echo off
REM
REM Run the VSVARS32.BAT to setup the MS-Dev environment
REM

REM Microsoft Visual Studio 2010
:VS2010
if not exist "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat" goto VS2008
call "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\vsvars32.bat"
goto Zeus

REM Microsoft Visual Studio 2008
:VS2008
call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" goto VS2005
goto Zeus

REM Microsoft Visual Studio 2005
:VS2005
if not exist "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat" goto Zeus
call "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"
goto Zeus

:Zeus
REM Start Zeus and it will take on these environment settings
start "" "C:\Program Files\Zeus\zeus.exe" -s

exit

Step 2: Create a Desktop Shortcut to the Batch File

Use the mouse right click button on the desktop an then use the New, Shortcut menu to create a shortcut with the following details:

Target: "C:\Program Files\Zeus\ze.cmd"
Run: Minimized
Icon: Hit the Change Icon button, browse to "C:\Program Files\Zeus\zeus.exe" and select the Zeus icon.

Now when Zeus is run from this shortcut it will inherit the Microsoft vsvars32.bat environment settings.

To test the configuration, start Zeus from the newly created shortcut and create the following test.cs file:
Code:
// Test.cs
public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!"); ?
   }                                         //  ^ this code should cause an error
}

Now using the Compiler, Compile menu results in this compiler output:
Quote:
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.1433
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

test.cs(6,50): error CS1525: Invalid expression term '?'
test.cs(6,51): error CS1002: ; expected

Now clicking on the error message will navigate to the line in error.

Fixing the error by removing the errant ? and recompiling will result in the creation of a working test.exe executable file:
Quote:
C:\temp>test.exe
Hello, World!

C:\temp>

Cheers Jussi


** Extra Debug Step if Required **

The batch file from above will only work if the vsvars32.bat file was located in the default Microsoft installer locations which may not always be the case.

Luckily the location of this batch file can be easily found from inside Zeus using the Tools, DOS Command Line menu and entering the following command:
Code:
dir "$MsVcVarsPath"

Running this command should result in the following output:
Quote:
Directory of C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools

29/07/2009 14:03 <DIR> .
29/07/2009 14:03 <DIR> ..
29/07/2009 14:02 <DIR> 1033
28/04/2005 18:04 11,197 AtlTraceTool8.chm
08/11/2007 08:19 75,272 AtlTraceTool8.exe
29/07/2009 14:00 <DIR> Deployment
08/11/2007 08:19 45,568 errlook.exe
02/08/2002 15:50 7,427 errlook.hlp
07/11/2007 12:01 31,744 guidgen.exe
08/11/2007 08:19 51,704 gutils.dll
08/11/2007 08:19 27,640 makehm.exe
19/10/2004 14:34 115,559 spyxx.chm
08/11/2007 08:19 631,800 spyxx.exe
08/11/2007 08:19 161,280 spyxxhk.dll
29/07/2009 13:59 <DIR> Templates
08/11/2007 08:19 21,504 uuidgen.exe
30/08/2007 15:31 1,748 vcvars.txt
29/07/2009 13:59 <DIR> VDT
29/07/2009 14:06 2,257 vsvars32.bat
13 File(s) 1,184,700 bytes
6 Dir(s) 50,424,692,736 bytes free

You will notice the results of the search locate the vsvars32.bat file in the the C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools folder.

This ties in with the code found in the batch file as shown below:
Code:
REM Microsoft Visual Studio 2008
:VS2008
call "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat" goto VS2005
goto Zeus

If you find the vsvars32.bat file in a different, non-default folder location the batch file will need to be modified to suit Wink
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Zeus IDE Forum Index -> Tutorials, Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group