Clone this wiki locally
VRPN builds and runs on a wide array of platforms and compilers. Here are some "gotchas" you might want to be aware of if you're writing code to go in VRPN.
Developed on Visual Studio, now building elsewhere...
- In general, Visual Studio implicitly includes more headers than other compilers, so if it builds in VS, it still may be missing headers. Include what you use.
defined(_WIN32)is the correct check to put around code that only makes sense on Windows.
defined(_MSC_VER)is the correct define to check if we're building with Visual Studio.
defined(_WIN32)does not imply
defined(_MSC_VER)- there are other compilers and cross-compilers.
Developed in modern tools...
snprintfis not available in older Visual Studio versions (2008?) so can't be used at the time being. TODO: Figure out a suitable solution.
Developed on a desktop...
- Byte order varies between machines. Always use the
ntohfunctions VRPN provides if you're putting data on the network on your own.
- On a related note, though USB data is often little-endian just like your desktop, that doesn't mean
memcpyworks everywhere to load USB data. Use
Developed on a POSIX (*nix/Mac OS X) system...
M_PIisn't in the C++ or C standard. It's a POSIX thing. TODO: Figure out what the solution is, without involving defining
M_PIin lots of source files.