Setting up the NCL library

Windows

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.

  1. Right-click on the strom project (not the strom solution) and choose Add > New Filter
  2. . Name the new filter (which is a virtual folder) ncl.

  3. 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.
  4. 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 _CRT_SECURE_NO_WARNINGS and _SCL_SECURE_NO_WARNINGS to 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.

  5. 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
    

    Change define std::sprintf std::sprintf_s to define sprintf sprintf_s (i.e. remove std:: from two places in this line). Now go to line 491 (or search for std::sprintf and remove the std:: from this line too, leaving only this on line 491:

    sprintf(fmtstr, "%%.%df", p);
    

Mac

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.

  1. Open a console window and navigate into Documents/libraries/ncl-2.1.18
  2. Type ./configure --prefix=$HOME
  3. Type make
  4. Type make install

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

  1. Choose Preferences…, then click in the Locations tab, and click Source Trees
  2. 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.
  3. Click on the blue strom project icon, then on the Build Settings tab
  4. Type header search in to the search box
  5. In the Header Search Paths row, double-click on the cell in the column with the blue project icon
  6. Click the + symbol and add $(NCL_ROOT)/include, pressing the enter key when finished
  7. Type library search in to the search box
  8. In the Library Search Paths row, double-click on the cell in the column with the blue project icon
  9. Click the + symbol and add $(NCL_ROOT)/lib/ncl, pressing the enter key when finished