Difference between revisions of "04-630 Software Development Environment"

From David Vernon's Wiki
Jump to: navigation, search
(Humour)
(04-630 Repository)
Line 37: Line 37:
 
You can opt for either the WIN32 installer (cmake-3.7.1-win32-x86.msi) 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). If you choose the installer option, note that if you already have CMake version 3.4 or earlier you much uninstall it first.
 
You can opt for either the WIN32 installer (cmake-3.7.1-win32-x86.msi) 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). If you choose the installer option, note that if you already have CMake version 3.4 or earlier you much uninstall it first.
  
=== ADS Repository ===
+
=== 04-630 Data Structures and Algorithms for Engineers Repository ===
  
Copy the full ADS repository to the <code>C:</code>  drive.   
+
Copy the full 04-630 repository to the <code>C:</code>  drive.   
This will be made available the next time the course is being run.
+
  
<!-- You can download a zip archive with all the files from  [http://www.vernon.eu/ADS.zip here]. -->
+
You can download a zip archive with all the files from  [http://www.vernon.eu/downloads/04-630.zip here].
  
Copy it to <code>C:</code> drive and unzip it so that you have a directory called <code>C:\ADS</code> with a sub-directory structure explained in class (for our purposes here, there will be an  <code>assignments</code>  sub-directory and it will contain an example <code>assignment</code> sub-directory ... later on there will be <code>C:\ADS\assignments\assignment1</code> and <code>C:\ADS\assignments\assignment2</code>, and so on).  A <code>C:\ADS\lectures</code>  sub-directory will also be added with the code from the lectures.
+
Copy it to <code>C:</code> drive and unzip it so that you have a directory called <code>C:\04-630</code> with a sub-directory structure explained in class (for our purposes here, there will be an  <code>C:\04-630\assignments</code>  sub-directory and it will contain an example <code>C:\04-630\assignments\assignment0</code> sub-directory ... later on there will be <code>C:\04-630\assignments\assignment1</code> and <code>C:\04-630\assignments\assignment2</code>, and so on).   
  
 +
There is also a <code>C:\04-630\lectures</code> sub-directory. Later, I will make available the code from the lectures together with instructions on how to add it to the repository (the source code will go in the <code>C:\04-630\lectures\src</code> sub-directory and test data will go in the <code>C:\04-630\lectures\data</code> sub-directory.
  
The next step is to build a MSVC++ <code>.sln</code> solution file so that you can compile all the ADS executables. To do this, you need to run CMake against the <code>C:ADS\assignment</code> directory (where you will find the main <code>CMakeLists.txt</code> file).
+
 
 +
The next step is to build a MSVC++ <code>.sln</code> solution file so that you can compile the 04-630 executables. To do this, you need to run CMake against the <code>C:04-630\assignments\assignment0</code> directory (where you will find the main <code>CMakeLists.txt</code> file).    We use <code>assignment0</code> because it is a dummy assignment but you will follow exactly the same procedure for all the real assignments.
  
 
* Launch the CMake GUI from the Windows 7 toolbar.
 
* Launch the CMake GUI from the Windows 7 toolbar.
  
* In the ''Where is the source code:'' input (browse to)  <code>C:\ADS\assignments\assignment</code>
+
* In the ''Where is the source code:'' type (or browse to)  <code>C:\04-630\assignments\assignment0</code>
  
* In the ''Where to build the binaries:'' input (browse to) <code>C:\ADS\assignments\assignment\build</code>
+
* In the ''Where to build the binaries:'' type (or browse to) <code>C:\04-630\assignments\assignment0\build</code>
  
* 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)
+
* 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 04-630 directory)
  
 
* Click ''Configure''
 
* Click ''Configure''
Line 65: Line 66:
 
* Click ''Configure'' again and everything should be fine.
 
* Click ''Configure'' again and everything should be fine.
  
* Click ''Generate''  to create the MSVC++ <code>assignment.sln</code> file in <code>C:\ADS\Assignment\build</code>. Do this twice.
+
* Click ''Generate''  to create the MSVC++ <code>assignment0.sln</code> file in the <code>C:\04-630\assignments\assignment0\build</code> directory. Do this twice.
  
  
Now you are ready to launch MSVC++ and build the ADS assignment executables.   
+
Now you are ready to launch MSVC++ and build the 04-630 assignment0 executable.   
  
* Go to the <code>C:\ADS\assignments\assignment\build</code> directory and open the <code>Assignment.sln</code> file.  This launches Microsoft Visual C++ 2010 Express.
+
* Go to the <code>C:\04-630\assignments\assignment0\build</code> directory and open the <code>assignment0.sln</code> file.  This launches Microsoft Visual C++ 2010 Express.
  
 
* Select <code>Release</code> in the ''Solutions Configuration'' box.
 
* Select <code>Release</code> in the ''Solutions Configuration'' box.
Line 77: Line 78:
  
  
This will compile and link the programs in the the <code>C:\ADS\assignments\assignment\src</code> sub-directory and install then in the <code>C:\ADS\assignments\assignment\bin</code> directory.  
+
This will compile and link the programs in the the <code>C:\04-630\assignments\assignment0\src</code> sub-directory and install then in the <code>C:\04-630\assignments\assignment0\bin</code> directory.  
 +
 
  
 +
Check to see that the example  <code>Vernon.exe</code> 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. 
  
Check to see that the example  <code>Vernon</code> 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.
+
'''Note that you will have to tick this check-box every time you rebuild the a <code>.sln</code> solution file with CMake.''' If you don't do this, then your new executable won't be installed in the <code>bin</code> directory and you'll end up becoming very confused because non of the changes you make to your source code will be reflected in the executable you run from the <code>bin</code> directory (because its an old version from a previous compilation).
  
  
You are now ready to run the example <code>Vernon</code>  application that is provided with the ADS release. To do this, double click the< code>Vernon</code> executable in <code>C:\ADS\assignments\assignment\bin</code>.  Open <code>input.txt</code> file and, after running <code>Vernon</code>, the <code>output.txt</code> file.
+
You are now ready to run the example <code>Vernon.exe</code>  application that is provided with the 04-630 release. To do this, double click the< code>Vernon.exe</code> executable in <code>C:\04-630\assignments\assignment0\bin</code>.  Open <code>input.txt</code> file in <code>C:\04-630\assignments\assignment0\data</code>and, after running <code>Vernon.exe</code>, open the <code>output.txt</code> file, also in the <code>C:\04-630\assignments\assignment0\data</code> directory.
  
  
To develop your own assignment program, you need to edit the <code>C:\ADS\assignments\assignment\src\CMakeLists.txt</code> file and uncomment out the line with your name by deleting the <code>#</code> character at the beginning of the line.   Now, copy your source files (<code>.c, .cpp, .h</code>) to the directory with your name, and then run CMake again.  Then re-open the <code>Assignment.sln</code> file. Your files should now be visible and you can now compile your code and install it in the <code>bin</code> 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 <code>C:\ADS\assignments\assignment\bin</code> directory.
+
To develop your own (dummy) assignment program, you need to edit the <code>C:\04-630\assignments\assignment0\src\CMakeLists.txt</code> file and uncomment out the line with your name by deleting the <code>#</code> character at the beginning of the line. Alternatively, if there is not a line with your name, then type in a new line <code>ADD_SUBDIRECTORY(Mylastname)</code>, replacing <code>Mylastname</code> with your actual last name.  Now, create a directory with your name, e.g.  <code>C:\04-630\assignments\assignment0\src\Mylastname</code>, and copy the <code> source files (<code>.c, .cpp, .h</code>) from the <code>Vernon</code> directory to the directory with your name.  Now run CMake again.  Then re-open the <code>assignment.sln</code> file. Your files should now be visible and you can now compile your code and install it in the <code>bin</code> 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 <code>C:\04-630\assignments\assignment0\bin</code> directory.
  
 
== Humour ==
 
== Humour ==

Revision as of 00:22, 31 December 2016

This guide provides a step-by-step guide to downloading, installing, and using the software required to submit an assignment for course 04-630 Data Structures and Algorithms for Engineers. This environment is required to ensure that software developed by students can be compiled directly by the course instructor after it has been submitted.

Operating System

I assume you are running Windows 7.

I strongly recommend you turn off the option in Windows Explorer to hide file extensions. To do this, from Windows Explorer menu bar select Tools > Folder Options > View and make sure the tick box labelled Hide extensions for known file types is not ticked. If it is ticked, you will have problems identifying certain files later on (e.g. invoking the example.sln solution file to launch the C++ compiler).

If the Windows Explorer menu bar isn't visible, select Organize > Layout > Menu bar

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 installer from here.

Run the installer and follow the instructions.

Some versions of Windows 7 may need the the Microsoft Visual Studio 2010 Service Pack 1 to be installed. If you have problems with CMake (see below) this is almost certainly the cause. Download and install Service Pack 1 by from here. You can check to see whether or not you have Service Pack 1 by checking the your version number: from the Microsoft Visual C++ 2010 Express menu, select Help > About Visual C++ 2010 Express. You will see a message on the top right something like the following.

Microsoft Visual Studio 2010
Version 10.0.40219.1 RTMRel
Microsoft .NET Framework
Version 4.0.30319 RTMRel

The RTMRel means Release To Manufacturing. If you have Service Pack 1 installed you would see something like the following.

Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.0.30319 SP1Rel

CMake

Download CMake binaries from here. At time of writing the latest version is 3.7.1.

You can opt for either the WIN32 installer (cmake-3.7.1-win32-x86.msi) 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). If you choose the installer option, note that if you already have CMake version 3.4 or earlier you much uninstall it first.

04-630 Data Structures and Algorithms for Engineers Repository

Copy the full 04-630 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:\04-630 with a sub-directory structure explained in class (for our purposes here, there will be an C:\04-630\assignments sub-directory and it will contain an example C:\04-630\assignments\assignment0 sub-directory ... later on there will be C:\04-630\assignments\assignment1 and C:\04-630\assignments\assignment2, and so on).

There is also a C:\04-630\lectures sub-directory. Later, I will make available the code from the lectures together with instructions on how to add it to the repository (the source code will go in the C:\04-630\lectures\src sub-directory and test data will go in the C:\04-630\lectures\data sub-directory.


The next step is to build a MSVC++ .sln solution file so that you can compile the 04-630 executables. To do this, you need to run CMake against the C:04-630\assignments\assignment0 directory (where you will find the main CMakeLists.txt file). We use assignment0 because it is a dummy assignment but you will follow exactly the same procedure for all the real assignments.

  • Launch the CMake GUI from the Windows 7 toolbar.
  • In the Where is the source code: type (or browse to) C:\04-630\assignments\assignment0
  • In the Where to build the binaries: type (or browse to) C:\04-630\assignments\assignment0\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 04-630 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++ assignment0.sln file in the C:\04-630\assignments\assignment0\build directory. Do this twice.


Now you are ready to launch MSVC++ and build the 04-630 assignment0 executable.

  • Go to the C:\04-630\assignments\assignment0\build directory and open the assignment0.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:\04-630\assignments\assignment0\src sub-directory and install then in the C:\04-630\assignments\assignment0\bin directory.


Check to see that the example Vernon.exe 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.

Note that you will have to tick this check-box every time you rebuild the a .sln solution file with CMake. If you don't do this, then your new executable won't be installed in the bin directory and you'll end up becoming very confused because non of the changes you make to your source code will be reflected in the executable you run from the bin directory (because its an old version from a previous compilation).


You are now ready to run the example Vernon.exe application that is provided with the 04-630 release. To do this, double click the< code>Vernon.exe</code> executable in C:\04-630\assignments\assignment0\bin. Open input.txt file in C:\04-630\assignments\assignment0\dataand, after running Vernon.exe, open the output.txt file, also in the C:\04-630\assignments\assignment0\data directory.


To develop your own (dummy) assignment program, you need to edit the C:\04-630\assignments\assignment0\src\CMakeLists.txt file and uncomment out the line with your name by deleting the # character at the beginning of the line. Alternatively, if there is not a line with your name, then type in a new line ADD_SUBDIRECTORY(Mylastname), replacing Mylastname with your actual last name. Now, create a directory with your name, e.g. C:\04-630\assignments\assignment0\src\Mylastname, and copy the source files (<code>.c, .cpp, .h) from the Vernon directory to the directory with your name. Now 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:\04-630\assignments\assignment0\bin directory.

Humour

After all that, a little course-related humour might be welcome (if these don't make sense now, they will later).

Some Ineffective Sorts

Travelling Salesman Problem