Set up Visual Studio

You can use Visual Studio 2005 or 2008 to build the application with LSF APIs.

  1. Create a Win32 Console project.
  2. Add a test program as the source file test.c .
    Test Program:
    ---------------------------------------------------------------
    #include <stdio.h>
    #include <lsf/lsf.h>
    void main()
    {
        char *clustername;
        clustername = ls_getclustername();
        if (clustername == NULL) {
            ls_perror("ls_getclustername");
            exit(-1);
        }
        printf("My cluster name is: <%s>\n", clustername);
        exit(0);
    }
  3. Add the LSF 7.0 include and lib directories as additional include and library directories.
  4. Add the following lib files as additional dependencies:
    • oldnames.lib

    • mpr.lib

    • netapi32.lib

    • userenv.lib

    • activeds.lib

    • adsiid.lib

    • liblsf.lib

    • libbat.lib

    • WSOCK32.lib

    • WS2_32.lib

    • MSWSOCK.lib

  5. Include any special build options, as required.

    For example, in Visual C++ 2005, the size of the time_t data type was changed from 32 bits to 64 bits. However, the LSF package is built with VC60 (in which size of time_t data type is 32 bits). To solve, choose one of the two following solutions:

    • In Visual Studio, change the C/C++ command line additional options to include -D "_USE_32BIT_TIME_T".

    • Add one line to the beginning of stdafx.h.

      #define _USE_32BIT_TIME_T

    To change the build environment from 32 to 64 bits, add the build option -D"WIN32".