I've decided to start documenting my adventures in Microsoft's
Visual C++. Subjects may range from coding hacks to configuration
workarounds.
Saturday, January 12, 2002
CVS and Workspaces
I've discovered that MSVC does not handle text files very well. When a MSVC
workspace is checked out on a Unix platform, then copied onto a Windows
platform, the carriage return format is not compatible with MSVC. I would
consider this a bug in Visual Studio, since the compiler does not complain about
these kinds of text files. I discovered this when building a distribution of
TPTLib on my FreeBSD server.
The work around is to check in all workspace and project files (.dsp and .dsw)
with the -kb flag. You can run "cvs udate -kb project.dsw project.dsp" to add
the flag. The -kb flag tells CVS that this is a binary file, so it won't modify
the carriage returns on a Unix platform.
Monday, October 22, 2001
Installed Platform SDK on top of STLPort - MSVC 6.0
Today I installed the Microsoft Platform SDK and everything
broke. I finally traced the poblem down to a file in the STLPort.
The header "stl/_threads.h" has function prototypes for
InterlockedIncrement, InterlockedDecrement, and InterlockedExcahange
which are set based on the compiler version instead of the library
version.
#if (_MSC_VER >= 1300)
The problem is that I'm running _MSC_VER=1200, but now I have the
latest Platform SDK, which uses the 1300+ declarations of the afore
mentioned functions. My temporary fix was to change the line to
#if (_MSC_VER >= 1200)
until the maintainers of the STLPort release a patch.
Lastly, when integrating the Platform SDK with MSVC 6.0, the include
paths are modified to have the SDK included first. I moved the
STLPort include path back to the top of the list in
Tools/Options/Directories.
Thursday, October 4, 2001
Installed STLPort 4.5 - MSVC 6.0
I've installed the STLPort version 4.5 from stlport.org. I
did speed testing by reading a words dictionary file for the ispell
utility containing 280 thousand words into the various containers,
then iterating through the containers and freeing the containers.
The STLPort came out about 7 times faster than the STL distributed
with MSVC 6.0 on all tests. That was reason enough to change.
The interesting thing to note here is that the STL Port is easiest
to use on Windows if you compile multithreaded, so to make the test
fair, I also compiled my MSVC test multithreaded. Even if I comiled
the MSVC test as single-threaded, the multithreaded STLPort test
program was over 3 times faster.
After installing the port, I had to modify
%INCLUDE%\stlport\stl_user_config.h to set
#define _STLP_DO_IMPORT_CSTD_FUNCTIONS 1
to make the STL import the standard C library functions into the
"std" namespace. NOTE: MSVC 6.0 does not fully handle namespaces
correctly, so all the standard library functions will appear in
both the "std" namespace, and the global namespace. This means
that if you are used to using
using namespace std;
stop it.
Next I added the stlport include directory to my Visual Studio configured
Include directories as the first include path to check. This allows the
STL Port headers to override default MSVC headers.
Once the STL Port is configured, I made sure to compile all my projects
as multithreaded (that's -MT from the command line), and link with the
appropriate stlport_vc6*.lib file.
Tuesday, April 9, 2002
Changed NT domain and compilation broke
After my company switched my NT domain name on me, I was farely annoyed to
discover that all my MSVC settings went away. I reset my colors (why aren't
there theme files like every other Microsoft app?) Most annoying was that my
programs stopped building with header file related errors.
A little investigation under Tools/Options/Directories showed that my directory
settings were lost in the transition as well. I added my directories back in.
This fixed the file not found errors, but there were still strange compilation
errors that resembled problems I've written about in past months.
Returning to Tools/Options/Directories, I realized my include directories were
out of order. This could also be a problem for my library directories, so I changed
the library search order as well.
I ordered the directories to search in this order: stlport, platform sdk,
original MSVC include dirs, my include dirs.
The above contents are provided voluntarily by the author with no guarantee of
accuracy.