How to compile WinNFSd with Visual Studio?
Recently I needed an NFS server on Windows, preferably written in C++. A long time ago I had used WinNFSd and sure enough the project still exists on Sourceforge, though unfortunately it hasn’t been updated since 2005.
However, I found that someone had updated it here: https://github.com/noodle1983/winnfsd-nd
So the big question, how do you compile this on windows with Visual Studio?
Step 1 – Download and extract the WinNFSd source
- Go to https://sourceforge.net/projects/winnfsd and download the source.
Note: You can alternately download the git hub source as it has an update you might like:
https://github.com/noodle1983/winnfsd-nd - Click the Zip button at the top of the page to download the source as a zip.
Note: Alternately if you have git working already you can clone this repo. - Extract the zip file to a directory. Remember where you extracted it as we will copy the source files later.
Step 2 – Create a new Visual Studio solution
- In Visual Studio, go to File | New | Project.
- Select Other Languages | Visual C++ | Empty Project.
Note: Depending on your Visual Studio configuration you may Visual C++ in a different place. - Name the solution WinNFSd.
- Click Ok.
Step 3 – Add the WinNFSd files to your solution
- In Visual Studio, right-click on your Project and click Open Folder in Windows Explorer.
- Create a new folder to hold your source code.
Note: I simply named my folder src. - Copy the source you extracted in Step 1 into the src directory.
- Highlight all the files in the src directory.
- Drag the files into Visual Studio and drop them on your project.
Step 4 – Configure the project properties
- In Visual Studio, right-click on your project and choose Properties.
Note: The Configuration should say Active(Debug) currently. - Go to Configuration Properties | Linker | Input.
- Add ws2_32.lib to the Additional Dependencies.
- Change the Configuration to Release and add ws2_32.lib for release as well.
Step 5 – Handle the Visual Studio C++ Runtime
If you were to compile now, and try to run your project on a different machine (not the one running Visual Studio) you would likely get an error due to a missing dll. Here is the error you will likely receive.
The program can’t start because MSVCR100.dll is missing from your computer. Try reinstalling the program to fix this problem.
I am not going to explain the solution again here, because it is all documented here:
Avoiding the MSVCR100.dll or MSVCR100D.dll is missing error
Choose the best of the three solutions for you from the link above.
Note: For this single file exe, I prefer the statically linked option.
Step 6 – Build WinNFSd
- You should now be able to click Build | Build Solution and it should build.
You should be able to test both debug and release.
Note: I received 37 warnings, which would be nice to resolve, but I wouldn’t worry too much about them.