Download and install the Nexus Class Library using the green download button at the NCL SourceForge site. Unzip the ncl-2.1.18.tar.gz file into your This PC\Documents\libraries directory to create the directory This PC\Documents\libraries\ncl-2.1.18. (Again, I strongly recommend using the program 7-zip to unzip the downloaded zip file.)
There is no batch file or Visual Studio project for building NCL in Windows, so we will just add it directly to our strom project.
- Right-click on the strom project (not the strom solution) and choose Add > New Filter. Name the new filter (which is a virtual folder) ncl.
- Right-click on your new ncl filter/folder and choose Add > Existing Item…, navigate to This PC\Documents\libraries\ncl-2.1.18\ncl and select all files except Makefile.am and Makefile.in. You should now see some 41 files inside the ncl filter/folder.
- Bring up the Properties panel for the project by right-clicking on the strom project (not the strom solution) and choosing Properties from the popup menu. Click C/C++, then Preprocessor, and add
_SCL_SECURE_NO_WARNINGSto the Preprocessor Definitions. This will prevent errors related to NCL’s use of functions of which Visual Studio does not approve. Because the NCL is not our code, we are effectively just telling Visual Studio to look the other way.
- Finally, you will need to make a couple of changes to the file
nxsstring.cpp, which is part of the source code for the NCL library. Find the section (starting at line 250) containing these Windows-specific preprocessor definitions:
#if defined(_MSC_VER) # pragma warning(disable:4786) # pragma warning(disable:4291) # if _MSC_VER >= 1500 # include # if !defined(vsnprintf) # define vsnprintf _vsnprintf_s # endif # define std::sprintf std::sprintf_s # else # define vsnprintf _vsnprintf # endif #endif
define std::sprintf std::sprintf_sto
define sprintf sprintf_s(i.e. remove
std::from two places in this line). Now go to line 491 (or search for
std::sprintfand remove the
std::from this line too, leaving only this on line 491:
sprintf(fmtstr, "%%.%df", p);
Download and install the Nexus Class Library using the green download button at the NCL SourceForge site. Unzip the ncl-2.1.18.tar.gz file into your Documents/libraries folder to create the directory Documents/libraries/ncl-2.1.18.
- Open a console window and navigate into Documents/libraries/ncl-2.1.18
Once NCL has compiled, the header files should be in the include directory under your home director, and the dynamic link library should be located in the lib director under your home directory. We now need to add these locations to the Xcode search paths. In Xcode
- Choose Preferences…, then click in the Locations tab, and click Source Trees
- Click the + button and add name
NCL_ROOT, Display Name
NCL_ROOT, and, for Path, enter the full path to your home directory. I, for example, entered /Users/plewis (but you could also enter $HOME, which expands to your home directory). This creates a macro of sorts that we can use in place of this path to specify where the NCL libraries and headers reside. Should we ever move NCL, we need only update the Source Trees path and will not have to modify the Xcode project.
- Click on the blue project icon labeled strom at the top of the Project Navigator (not the yellow folder icon labeled strom), then click on the Build Phases tab. Click the + sign in Link Binary With Libraries and choose the libncl-2.1.18.dylib file in $HOME/lib/ncl
- Click on the blue strom project icon, then on the Build Settings tab
header searchin to the search box
- In the Header Search Paths row, double-click on the cell in the column with the blue project icon
- Click the + symbol and add
$(NCL_ROOT)/include, pressing the enter key when finished
library searchin to the search box
- In the Library Search Paths row, double-click on the cell in the column with the blue project icon
- Click the + symbol and add
$(NCL_ROOT)/lib/ncl, pressing the enter key when finished