Difference between revisions of "Algorithms and Data Structures"

From David Vernon's Wiki
Jump to: navigation, search
Line 27: Line 27:
 
== ADS Repository ==
 
== ADS Repository ==
  
Copy the full ADS repository to the <code>C:</code>  drive.  You can download a zip file will all the files from [http://www.vernon.eu/ADS.zip here].  
+
Copy the full ADS repository to the <code>C:</code>  drive.  You can download a zip archive with all the files from [http://www.vernon.eu/ADS.zip here].  
  
  

Revision as of 00:12, 20 September 2014

This guide provides a step-by-step guide to downloading, installing, and using the software required to submit an assignment for the Algorithms and Data Structures course.

Operating System

I assume you are running Windows 7.

C/C++ Compiler

Download the Microsoft Visual C++ Express compiler, version 10.0 (also known as Visual C++ 2010 or MSVC++ 2010). It is important to use this version; earlier versions are no longer supported by Microsoft and later versions cause problems with some libraries.


You can download the required compiler from here.


Run the installer and follow the instructions.


Once the compiler is installed, try compiling a simple program. Some versions of Windows 7 may need the the Microsoft Visual Studio 2010 Service Pack 1 to be installed. If you get an error trying to compile and run a simple program, this may be the problem. CMake (see below) will also fail in this case.

CMake

Download CMake binaries from here.


You can opt for either the WIN32 installer or the Windows zip file. The installer has the advantage that it gives you the option to update your system path automatically (which you should take by clicking the appropriate radio button during the installation process).

ADS Repository

Copy the full ADS repository to the C: drive. You can download a zip archive with all the files from here.


Copy it to C: drive and unzip it so that you have a directory called C:\ADS with a sub-directory structure explained in class (for our purposes here, there will be an assignments sub-directory and it will contain an example assignment sub-directory ... later on there will be C:\ADS\assignments\assignment1 and C:\ADS\assignments\assignment2, and so on). A C:\ADS\lectures sub-directory will also be added with the code from the lectures.


The next step is to build a MSVC++ .sln solution file so that you can compile all the ADS executables. To do this, you need to run CMake against the C:ADS\assignment directory (where you will find the main CMakeLists.txt file).

  • Launch the CMake GUI from the Windows 7 toolbar.
  • In the Where is the source code: input (browse to) C:\ADS\assignments\assignment
  • In the Where to build the binaries: input (browse to) C:\ADS\assignments\assignment\build
  • Select File > Delete Cache from the top menu (you must do this the first time in case there is an old invalid configuration in the ADS directory)
  • Click Configure
  • Select Visual Studio 10 (2010) from the drop-down menu as the generator for the project
  • Click Finish and watch CMake configure your project. The dialogue box will still highlighted in red so ...
  • Click Configure again and everything should be fine.
  • Click Generate to create the MSVC++ assignment.sln file in C:\ADS\Assignment\build. Do this twice.


Now you are ready to launch MSVC++ and build the ADS assignment executables.

  • Go to the C:\ADS\assignments\assignment\build directory and open the Assignment.sln file. This launches Microsoft Visual C++ 2010 Express.
  • Select Release in the Solutions Configuration box.
  • Select Build > Build Solution from the top menu, (if you don't see this and you see Debug > Build Solution instead, it's probably because your IDE is set to basic settings. To change this, select Tools > Settings > Expert Settings).


This will compile and link the programs in the the C:\ADS\assignments\assignment\src sub-directory and install then in the C:\ADS\assignments\assignment\bin directory.


Check to see that the example Vernon executable is there. If it is not, then select 'Build > Configuration Manager from the menu and make sure the INSTALL check-box is ticked. Now rebuild the project again.


You are now ready to run the example Vernon application that is provided with the ADS release. To do this, double click the< code>Vernon</code> executable in C:\ADS\assignments\assignment\bin. Open input.txt file and, after running Vernon, the output.txt file.


To develop your own assignment program, you need to edit the C:\ADS\assignments\assignment\src\CMakeLists.txt file and uncomment out the line with your name by deleting the # character at the beginning of the line. Now, copy your source files (.c, .cpp, .h) to the directory with your name, and then run CMake again. Then re-open the Assignment.sln file. Your files should now be visible and you can now compile your code and install it in the bin directory by selecting Build > Build Solution from the top menu. Again, make sure that the INSTALL check-box is ticked when you select Build > Configuration Manager from the menu to ensure that your executable is installed in the C:\ADS\assignments\assignment\bin directory.