Setting up Visual Studio and C SDK

Discussion created by jonhcw on Jul 10, 2014
Latest reply on Jun 14, 2017 by yasal01

I've faced a lot of issues setting up Visual Studio for building C probes. There's not a lot of documentation on the subject. I thought I'd post my findings here in case they might help someone else. I'm not very well acquinted with C and have used VS with only C# formerly, so I wouldn't go as far as call myself any sort of expert on either. Meaning, there might be easier / better ways to get some of these things done.


My setup to start with was something like this (for relevant parts):


What I ended up was something like this:

Here's what I've done in somewhat relevant order:


C SDK libraries and headers
It's not enough to distribute the C SDK to a machine and just grab the headers and libraries from there. Even on x64 machines, you'll sometimes end up with x86 section distributed. Also, it's likely you'll want different architectures anyway. It's arguable what the best way to get the files is, but one way is to modify the section targets in the package. That's what I initially did to make sure I got both x86 and x64. You'll need to get the correct files for your project.


Visual Studio versions
I'm sure most (2008 and newer) versions of VS should be alright. I started out with VS2010 and was perfectly happy with it. However, it's good to use platform toolset v90, for which you need VS 2008. Platform toolset v90 means that you'll have a dependency on VC redistributable 2008, which is what Nimsoft robot uses and installs with the robot as well. If you go with v100 (default for VS 2010), you'll have dependency on VC redistributable 2010 and you'll need to make sure yourself that it's installed on the target server.


I installed VS 2008 pro edition. By default it does not install headers and libraries for x64 targets, so you might want to check those in custom install dialog, install with full features or add the feature after installation. You can also use VS 2008 express edition, but it doesn't support x64 by default. Apparently there are some hacks to get x64 targets working with it.



At first I used the headers / libraries from the slproweb package. However, they have dependency on ssleay32.dll and libeay32.dll, which you'd need to ship with your probe package for it to work. Need static libs..


This is the bit that requires activeperl to be installed (apparently strawberry wont work). I found these instructions to be pretty good: My only problem so far is getting the 32-bit libs built.


Setting up Visual Studio project

With both VS 2008 and 2010 installed I could now use either one. Being more familiar with 2010, I'm going with that one. Setting up the project in 2008 doesn't deviate much, though. This is for a x64 target.


  1. New Project -> Visual C++ -> Win32 Console application -> OK
  2. Next
  3. Check Empty project
  4. Finish
  5. Solution Explorer -> Source Files -> right-click -> new -> c++ file (.cpp) -> name ->  <yourfile.c> -> Add
  6. Solution Explorer -> Right-click project -> properties
  7. Configuration Manager -> Platform -> New platform -> x64 -> OK -> Close
  8. Configuration Properties -> Platform Toolset -> V90
  9. Configuration Properties -> C/C++ -> General -> Additional Include directories -> Add values for your Nimsoft C SDK include dir and the include directory where you built your OpenSSL libs.
  10. Configuration Properties -> C/C++ -> Advanced -> Compile As -> Compile as C Code (/TC)
  11. Configuration Properties -> Linker -> General -> Additional Library Directories -> Add values for your Nimsoft C SDK and the Libs directory where you built your OpenSSL libs.
  12. Configuration Properties -> Linker -> Input -> Additional dependencies -> Add these values "ws2_32.Lib;nim.lib;pt.lib;port.lib;libeay32.lib;ssleay32.lib"


That pretty much covered it for me, if I remembered all the steps here.