|
TYX Corporation
How to compile with MSVC++7.0 Versions used: Paws Studio: 1.26.7 Operating System: Windows 2000 Requirements: Paws developer Studio Microsoft Visual
Studio 7.0 If you are using the
version 7.1 or the sdk packages 1.0 or 1.1, you will have to adjust the content
of this document with the proper variables. Introduction: This document will help
configuring the environment in order to use Microsoft Visual Studio 7.0 to
compile a PAWS project, which includes a CEM module. If you intend to use
Win NT 4.0 or XP, you will find this document useful. Some of the details may
however vary, such as when the environment variables are made available to
other new or older instances of exes but those differences should be easy to
overcome. If your environment
is not set up properly, you will have building problems. The first problem
that you will have is that it won’t be able to find the compilers. If you have
an rc file for the dll version, it will complain that it can’t find the rc.exe,
otherwise, it will complain that it can’t find the cl.exe. There are two ways to approach the issue as far
as setting up the OS environment: a) You
can either use a batch file that is provided to you by the MS Studio. b) Or
you can configure the environment variables manually. There are differences in using method a) versus
method b). However, if you understand the implication that comes with the
method that you use, you should be able to reach your goal. Those differences
will be explained as we go along. An additional method is to provide all the
necessary information in the Paws Studio (CEM options) and give the path for
the compilers: cl.exe, rc.exe and link.exe and the paths to the .h and .lib
files that come with the MS Studio and are needed at compilation time. Warning: If you make mistakes in the process of changing the environment
variables or deleting variables that you should not have deleted, you may
compromise the functionality of your Operating System or other software
application, which could have otherwise be avoided. Any changes to the
environment variables, you will do at your own risk. It is recommended ·
That you should manipulate the
environment variables only if you understand the consequences of each one of
the steps you execute. ·
That you read the document from
top to bottom in order to understand each step. Failure to do so will most likely
render your computer’s behavior unpredictable. 1 METHOD 1:The basic objective is to run the batch file provided to you by MS Visual Studio 7.0. This will do the following:
1.1 Basic method with the batch file:1.1.1 Batch file name:The batch file is called vsvars32.bat. 1.1.2 The location for the batch file:C:\Program Files\Microsoft Visual Studio .NET\Common7\Tools Note: If you did not install the Microsoft Visual Studio 7.0 in the default location, you will need to look for it in the folder that you used to install it. 1.1.3 Basic functionality:
1.1.4 Example:1.1.4.1 Checking on your environment before running the batch file:
ALLUSERSPROFILE=C:\Documents and
Settings\All Users APPDATA=C:\Documents and
Settings\Administrator\Application Data CommonProgramFiles=C:\Program
Files\Common Files COMPUTERNAME=TESTPC ComSpec=C:\WINNT\system32\cmd.exe HOMEDRIVE=C: HOMEPATH=\ INCLUDE=C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include\ LIB=C:\Program Files\Microsoft
Visual Studio .NET\FrameworkSDK\Lib\ LOGONSERVER=\\TESTPC NUMBER_OF_PROCESSORS=1 OS=Windows_NT Os2LibPath=C:\WINNT\system32\os2\dll; Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6
Model 8 Stepping 3, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0803 ProgramFiles=C:\Program Files PROMPT=$P$G SystemDrive=C: SystemRoot=C:\WINNT TEMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp TMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp USERDOMAIN=TESTPC USERNAME=Administrator USERPROFILE=C:\Documents and
Settings\Administrator VSCOMNTOOLS="C:\Program
Files\Microsoft Visual Studio .NET\Common7\Tools\" windir=C:\WINNT
1.1.4.2 Running the Batch file:
1.1.4.3 Looking at the environment variables a second time:
ALLUSERSPROFILE=C:\Documents and Settings\All Users APPDATA=C:\Documents and Settings\Administrator\Application
Data CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=TESTPC ComSpec=C:\WINNT\system32\cmd.exe DevEnvDir=C:\Program Files\Microsoft Visual Studio
.NET\Common7\IDE FrameworkDir=C:\WINNT\Microsoft.NET\Framework FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK FrameworkVersion=v1.0.3705 HOMEDRIVE=C: HOMEPATH=\ INCLUDE=C:\Program Files\Microsoft Visual Studio
.NET\VC7\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include\ LIB=C:\Program Files\Microsoft Visual Studio .NET\VC7\ATLMFC\LIB;C:\Program
Files\Microsoft Visual Studio .NET\VC7\LIB;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\lib;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\Lib\ LOGONSERVER=\\TESTPC MSVCDir=C:\Program Files\Microsoft Visual Studio .NET\VC7 NUMBER_OF_PROCESSORS=1 OS=Windows_NT Os2LibPath=C:\WINNT\system32\os2\dll; Path=C:\Program Files\Microsoft Visual Studio
.NET\Common7\IDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\BIN;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\bin;C:\WINNT\Microsoft.NET\Framework\v1.0.3705;C:\WINNT\system32;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 3,
GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=0803 ProgramFiles=C:\Program Files PROMPT=$P$G SystemDrive=C: SystemRoot=C:\WINNT TEMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp TMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp USERDOMAIN=TESTPC USERNAME=Administrator USERPROFILE=C:\Documents and Settings\Administrator VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET VSCOMNTOOLS="C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\" VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio
.NET\Common7\IDE 1.1.4.4 The difference between the two outputs:The difference
between the two outputs is going to be what is of interest to us. In bold, you have
the environment variables which are followed by the values that have been added
by the batch file: DevEnvDir = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE FrameworkDir = C:\WINNT\Microsoft.NET\Framework FrameworkSDKDir = C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK FrameworkVersion = v1.0.3705 INCLUDE = C:\Program Files\Microsoft Visual Studio
.NET\VC7\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include\ LIB = C:\Program Files\Microsoft Visual Studio .NET\VC7\ATLMFC\LIB;C:\Program
Files\Microsoft Visual Studio .NET\VC7\LIB;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\lib; LIB = C:\Program Files\Microsoft Visual Studio
.NET\VC7\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio
.NET\VC7\LIB;C:\Program Files\Microsoft Visual Studio
.NET\VC7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual Studio
.NET\VC7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\lib; MSVCDir = C:\Program Files\Microsoft Visual Studio .NET\VC7 Path = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE;C:\Program
Files\Microsoft Visual Studio .NET\VC7\BIN;C:\Program Files\Microsoft Visual
Studio .NET\Common7\Tools;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\bin;C:\WINNT\Microsoft.NET\Framework\v1.0.3705; VCINSTALLDIR = C:\Program Files\Microsoft Visual Studio .NET VSINSTALLDIR = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE 1.1.4.5 Running Paws:From that same
command window, you need to go to <usr>\tyx\bin, where <usr>
is c:\usr by default, and launch Paws.exe. This session of Paws
will be able to compile C/C++ files using the Microsoft compiler. Important
Note: If you close that
command window and you want to build a Paws project including a CEM module, you
will have to repeat the process: Run the batch file from a command window and
launch Paws Studio from that command window. 1.2 More advanced method using the batch file:This method is simply an automated version of the basic method. 1.3 Create a batch file:Simply create and run the batch file named startpaws.bat, in the <usr>\tyx\bin folder containing Paws.exe, where <usr> is the folder where Paws Studio was installed and is C:\usr by default. 1.4 Batch file content:The content of the batch file is the following: @SET VARSDIR=%VSCOMNTOOLS% @if "%VARSDIR%"=="" goto Usage @goto RunCommand :Usage @echo. VSCOMNTOOLS variable of Visual Studio 7.0 install not found @echo. Please reinstall Visual Studio 7.0 exit :RunCommand @CALL "%VARSDIR%vsvars32.bat" @CALL "paws.exe" exit Notes:
1.5 Final steps:
This is a batch file which will automatically set the system PATH then it starts Paws.exe application. It will automatically execute what was done manually in the basic method. Note: You will find a dos window remaining in the background after running startpaws.bat. This is due to the fact that the exit command will only be executed after Paws has been closed. You can simply ignore that command window and close it. 2 METHOD 2:This method will
help you configure the environment variables in the system in order to avoid
having to deal with batch files. First we need to
identify what environment variables need to be added and then we will go about
how to do this. The environment
variables will be set for either
There are issues
with adding environment variables in one or the other or both. Let us start
with the ground rules: 2.1 Ground rules for the environment variables:According to Microsoft, the rules are the following: Changing the System Environment Variables
Windows NT requires certain information to find programs, to allocate memory space for some programs to run, and to control various programs. This information — called the system and user environment variables — can be viewed using the System option in Control Panel in the Environment Variables tab. These environment variables are similar to those that can be set in the MS-DOS operating system, such as PATH and TEMP. The system environment variables are defined by Windows NT Workstation and Windows NT Server and are the same no matter who is logged on at the computer. If you are logged on as a member of the Administrators group, you can add new variables or change the values. The user environment variables can be different for each user of a particular computer. They include any environment variables you want to define or variables defined by your applications, such as the path where application files are located. After you change any environment variables in the Environment Variables tab in the System Properties dialog box and click OK, Windows NT saves the new values in the registry so they are available automatically the next time you start your computer. If any conflict exists between environment variables, Windows NT Workstation and Windows NT Server resolve the conflict in this way:
Note Path settings, unlike other environmental variables, are cumulative. The full path (what you see when you type path at the command prompt) is created by appending the path contained in Autoexec.bat to the paths defined in the System option in Control Panel. 2.2 What does that mean?The most important environment variables are PATH, INCLUDE and LIB. Other environment variables are unlikely to be used by another software. It means that you have to decide whether you want to add the variables for the user or the system.
o They will be available to the user alone and not for users that don’t have those environment variables set for them: It has to be done for each and every user that wants to have that available to them. o In the event that there is a conflict, it has the advantage that the user that has those environment variables set for them doesn’t care about the values for that variables set in the system, at the exception of PATH. We are now going to go over the steps of adding the proper values to the new environment variables addressed in vsvars32.bat. 2.3 Procedures to follow:2.3.1 Identifying the values for the new variables:2.3.1.1 Method 1: using the command window analysisIf we follow the procedure described in the sample for the basic method described above, we will end up by having the following list of new environment variables and values: DevEnvDir = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE FrameworkDir = C:\WINNT\Microsoft.NET\Framework FrameworkSDKDir = C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK FrameworkVersion = v1.0.3705 INCLUDE = C:\Program Files\Microsoft Visual Studio
.NET\VC7\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\INCLUDE;C:\Program Files\Microsoft Visual Studio
.NET\VC7\PlatformSDK\include\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include\ LIB = C:\Program Files\Microsoft Visual Studio .NET\VC7\ATLMFC\LIB;C:\Program
Files\Microsoft Visual Studio .NET\VC7\LIB;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib\prerelease;C:\Program Files\Microsoft Visual
Studio .NET\VC7\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\lib; MSVCDir = C:\Program Files\Microsoft Visual Studio .NET\VC7 PATH = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE;C:\Program
Files\Microsoft Visual Studio .NET\VC7\BIN;C:\Program Files\Microsoft Visual
Studio .NET\Common7\Tools;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\bin;C:\WINNT\Microsoft.NET\Framework\v1.0.3705; VCINSTALLDIR = C:\Program Files\Microsoft Visual Studio .NET VSINSTALLDIR = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE Those can be directly entered as such for the user or the system. 2.3.1.2 Method 2: using the batch file contentIf we look at the content of vsvars32.bat, we will see: @SET VSINSTALLDIR=C:\Program
Files\Microsoft Visual Studio .NET\Common7\IDE @SET VCINSTALLDIR=C:\Program
Files\Microsoft Visual Studio .NET @SET
FrameworkDir=C:\WINNT\Microsoft.NET\Framework @SET FrameworkVersion=v1.0.3705 @SET FrameworkSDKDir=C:\Program
Files\Microsoft Visual Studio .NET\FrameworkSDK @rem Root of Visual Studio common
files. @if
"%VSINSTALLDIR%"=="" goto Usage @if
"%VCINSTALLDIR%"=="" set VCINSTALLDIR=%VSINSTALLDIR% @rem @rem Root of Visual Studio ide
installed files. @rem @set DevEnvDir=%VSINSTALLDIR% @rem @rem Root of Visual C++ installed
files. @rem @set MSVCDir=%VCINSTALLDIR%\VC7 @rem @echo Setting environment for
using Microsoft Visual Studio .NET tools. @echo (If you also have Visual C++
6.0 installed and wish to use its tools @echo from the command line, run
vcvars32.bat for Visual C++ 6.0.) @rem @REM %VCINSTALLDIR%\Common7\Tools
dir is added only for real setup. @set
PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%; @set
INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\prerelease;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include;%INCLUDE% @set
LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib\prerelease;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib;%LIB% @goto end :Usage @echo. VSINSTALLDIR variable is
not set. @echo. @echo SYNTAX: %0 @goto end :end The values for PATH, INCLUDE and LIB use variables as well. This will allow to minimize the number of characters for the value of those variables. It has the advantage that if you want to make changes, you just need to make those changes in one place, mostly to correct any typos. You can also notice that it will precede the existing values for those variables with the new added values. Important Note: The order of the value is important. Let us say that you have two cl.exe on your system. One from Microsoft and one from National Instrument, in the PATH variable, the first cl.exe that is found in the order specified in the value will be the one that will be used. With the method used in the batch file above, it is guarantied to find the Microsoft cl.exe (compiler for c/c++) first. 2.3.2 Adding the new variables and the new values:We will go through the exercise of adding the new values and the new variables to the system, making sure that we will use the Microsoft compilers, header files and libraries before any other files and compilers from another software. If you wish to deviate from this exercise, you should have enough information to achieve your specific requirements. For additional information, please refer to documentation that can be found on the internet related to environment variables. Important note: Not entering the values, such as paths, in a proper format, will result in the system ignoring the end of the value that you have entered, which is the same as if you had not entered it. 2.3.3 Accessing the window to add environment variables ·
From the Control
Panel, open System.
·
Go to the Advanced
tab as shown below and click on Environment Variables…
· This will give you access to the following window:
· As you can tell, after installing Microsoft Visual Studio 7.0, you have variables INCLUDE and LIB for both the system and the users. It turns out that they have respectively the same values in both. · We will first add the new variables and their values and then we will proceed in deleting INCLUDE and LIB for the user so that their value won’t interfere with what we added in the system. 2.3.3.1 Adding new values:· The new values we want to add are going to be extracted from Method 1: using the command window analysis DevEnvDir = C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE FrameworkDir = C:\WINNT\Microsoft.NET\Framework FrameworkSDKDir = C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK FrameworkVersion = v1.0.3705 MSVCDir = C:\Program Files\Microsoft Visual Studio .NET\VC7 VCINSTALLDIR = C:\Program Files\Microsoft Visual Studio .NET 2.3.3.2 Adding values to existing variablesThis will be the case for PATH, INCLUDE and LIB. Rather than pressing New…, we will select each one of
those variables one by one and press Edit… · The list of values we will want to add will be extracted from the batch file vsvars32.bat: PATH =
%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%; INCLUDE =
%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\PlatformSDK\include\prerelease;%MSVCDir%\PlatformSDK\include;%FrameworkSDKDir%\include; LIB =
%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib\prerelease;%MSVCDir%\PlatformSDK\lib;%FrameworkSDKDir%\lib; ·
Those values
will precede the existing value for those variables. Please note the semicolon
that has to separate the new value from the old one. Without it, you would not
end up with a properly formatted value. ·
For example,
for PATH, once you have pressed Edit… you will have the following
window:
· You need to add the new path for the variable listed above, at the beginning of the value as seen below. In the image below, you can see the end of the new path for the value and the beginning of the old one, both of them separated by a semicolon
2.3.3.3 Deleting the INCLUDE and LIB variables at the user level: ·
You
need to select LIB and INCLUDE for the user variables
· And press Delete for each one of them. Warning: This assumes that there is no value in INCLUDE or LIB that
is not already in the system variables. In this case, you are only deleting
redundant information. Any other value associated to INCLUDE and/or LIB, that
is NOT in the system variables will need to be moved to the
corresponding system variables. Failure to do this will compromise the
functionality of your operating system or the functionality of other software
applications. Note: Do not delete any other user environment variables. If you
do, you will have to know the exact consequence of your actions. You can
recover from deleting variables by mistake by referring to the output files that
you were recommended to generate earlier in the document before making any
changes to the environment variables. · Press OK on this window and then on the following one:
2.3.3.4 Trying it out3 METHOD 3:
|