Imagix 4D User Guide


Microsoft Visual C++ Compiler

Microsoft Visual C++ is the compiler included with Microsoft Visual Studio, and as such it is the leading native compiler for Windows environments. The compiler was first introduced in 1993. msvc_win.inc, the compiler configuration file for Microsoft Visual C++ included with Imagix 4D, supports versions of the compiler back to Visual C++ 6.0, which was released in 1998.

Configuring msvc_win.inc for your environment consists mainly of refining the locations specified for the Visual C++ include directories. These include directories change between major releases of Visual Studio / Visual C++. In the user-modified section of the configuration file, a series of #if and #elif directives are used to separate the include directories specified for each release. Each individual include directory is specified through an msvc_win.inc entry something like:

#pragma cmdflag "-Sc:\program files\microsoft visual studio 15.0\vc\include"
The '#pragma cmdflag' instructs Imagix 4D's source analyzer to treat what follows as a command line option. The '-S' option causes the directory that follows to be added to the list of directories that are searched for #include files. By using a '-S' rather than a '-I', header files from that directory are treated as system (compiler) headers. The quotation marks (") are necessary because of the spaces in the include directory.

The __IMGX_MSVC_xxxxx__ macros used with the #if and #elif directives to separate the sets of include directories are controlled through the Imagix 4D gui. When you set up a Visual Studio-based Imagix 4D project, you specify a version of Visual Studio, which causes the appropriate __IMGX_MSVC_xxxxx__ macro to be defined. In msvc_win.inc, you may choose to override this, by modifying the macro definitions and the #if / #elif logic to hard code which set of '#pragma cmdflag' instructions are active.

Once you have determined which set(s) of '#pragma cmdflag' include directory options is appropriate for the release(s) of Visual Studio that you have installed, the next step is to determine where the Visual Studio header files are actually located in your environment. For older versions of Visual Studio, the locations are fairly standard and the defaults may not need to be adjusted. For newer versions, the locations can vary significantly. Fortunately, Visual Studio has functionality to help locate them.

This is done manually through the Visual Studio gui. In Visual Studio, open Project Properties. There, select VC++ Directories and within that, Include Directories. Select Edit from the dropdown; this opens a dialog that shows the actual path strings, not just the Visual Studio macro names.

If you do this for an empty Visual Studio project, you won't need to filter out the include directories that are specific to your project. Update the appropriate entries in the msvc_win.inc compiler configuration file to reflect these actual Visual Studio include directories, maintaining the order that they appear in the Visual Studio dialog. If additional '#pragma cmdflag' entries are necessary add them; if there are excess, remove them.