The Windows Startup SPA Solution offers a starting point for your project development and testing.
In CS3203 we offer two alternatives for your project development:
Please note that there is no difference in grading when choosing one of the two alternatives, as long as your README states clearly if we are to use a Windows machine or a MacOS/Linux machine for your final testing. The compilation and running process should be flawless no matter which alternative you choose.
This documentation is applicable to development in VS2022/2019 on Windows!
The files provided contain the AutoTester libraries needed and used for final testing in CS3203. Please make sure that you read the documentation about the AutoTester to be able to integrate your code with the AutoTester.
Download spa-win.zip and unzip it to your local directory.
Before attending the Tools Lab, you should download and install Visual Studio Community 2022/2019 via the Microsoft Azure Education portal.
When you start your installation you will be asked to choose what to install. You should choose at least the following packages:
The installation might take more than one hour!
If you have other versions of Visual Studio 2019, such as Visual Studio Enterprise 2022/2019, it should work as well.
This sample solution StartupSPASolution.sln can be used as a start-up framework for your project development and testing. This solution helps you organize code and test-cases, and run AutoTester.
There are two configurations: Debug & Release. We present the solution file in the Debug configuration, and the Release configuration should be handled in a similar fashion.
Debug configuration allows you to debug your code line by line, watch variable, put breakpoints, etc.
Release configuration does not allow debug functionalities, and generates an optimized output (executable/ library) that runs faster than the Debug version. It is used only in the final stages of the development and testing (submission). You should ensure that your team's implementation work as intended in Release configuration.
Please choose Win32 as the platform for Visual Studio development, due to compatibility issues between AutoTester.
StartupSPASolution.sln solution contains five projects:
SPA: This is a static library project. This project contains the implementation for your SPA. Currently, only a few key headers and CPP files have been created and added to this project. The files belonging to project SPA are located under folder StartupSPASolution\source
. You can add multiple folders/files with your source code.
All the other four projects are dependent on this project. Hence, when building any of the other four projects, this project is automatically built. The output after successfully building this project is a static library SPA.lib
located under StartupSPASolution\Debug
.
AutoTester: This is a Visual C++ Windows Console Application (without precompiled headers). This project integrates your SPA implementation with the AutoTester. Currently, only a few files are needed and added in this project. The files belonging to project AutoTester are located under folder StartupSPASolution\AutoTester\source
.
Follow the comments in StartupSPASolution\AutoTester\source\TestWrapper.cpp
and the instructions given for AutoTester to fill in this file with the calls to your SPA (SPA.lib
).
The folder StartupSPASolution\Tests
contains your SIMPLE code files and query files, in the format specified in the AutoTester documentation. This project depends on SPA project (SPA.lib
) and on AutoTester library contained in StartupSPASolution\lib
.
The output after successfully building this project is an executable file, AutoTester.exe, located under StartupSPASolution\Debug
.
UnitTesting: This is a Visual C++ Native Unit Test project. In this project, you should add unit tests created for your SPA. Currently, only one CPP file has been created and added to this project. The files belonging to project UnitTesting are located under folder StartupSPASolution\UnitTesting
.
This project depends on SPA project (SPA.lib
) and on Unit Tests headers. The output after successfully building this project is a dynamic library, UnitTesting.dll
, located under StartupSPASolution\Debug
. To run the tests, you need to navigate to Tests → Run
.
IntegrationTesting: This is a Visual C++ Native Unit Test project. In this project, you should put integration tests created for your SPA. Currently, only one CPP file has been created and added to this project. The files belonging to project IntegrationTesting are located under folder StartupSPASolution\IntegrationTesting
.
This project depends on SPA project (SPA.lib
) and on Integration Tests headers. The output after successfully building this project is a dynamic library, IntegrationTesting.dll
, located under StartupSPASolution\Debug
. To run the tests, you need to navigate to Tests → Run
.
To run your projects from Visual Studio, first set your start-up project to either AutoTester (Right-click on Autotester Project > Set as Startup Project
).
Note that only AutoTester project can be executed using the Run option from VS (green Run button). UnitTesting and IntegrationTesting have to be run from Tests menu, while SPA is a library without a main function (cannot run).
Running the AutoTester from VS requires you to correctly set your command line arguments from AutoTester Project Properties -> Debugging -> Command Arguments.
Running the AutoTester executable from command line is possible by opening a command prompt and typing AutoTester.exe from the Debug folder (where AutoTester.exe is located).
While the StartupSPASolution solution builds and links successfully, you may have problems in linking your projects and adding dependencies once you start modifying this solution. Here are a few things that you need to check in case you have linking errors (given for Debug configuration, while Release configuration is similar):
Solution properties: under “Project Dependencies” show the correct chain of dependencies among the projects in your solution.
Project properties: check the following:
Configuration Properties/General: ensure that the “Configuration Type” is either Static Library(.lib for SPA project), Application (.exe for AutoTester projects), or Dynamic Library (.dll for for UnitTesting and IntegrationTesting).
C/C++/Code Generation: ensure that the “Runtime Library” is “Multi-threaded Debug (/MDd)”. A linking error appears if this field is not set properly. You will not need to change this setting if you have linked the appropriate library.
C/C++ General: ensure that “Additional Include Directories” are correctly filled in. Fill in this field if you use external headers/files that are not defined in the project. Be sure to add the correct path to the external files. A building error appears if this field is not set properly.
Linker/Input: ensure that the “Additional Dependencies” contain the correct path and name to your libraries that you use in the project. Be sure to use the appropriate version of AutoTester for the correct build configuration (AutoTester_debug.lib, AutoTester_release.lib appropriately). A linking error (LNK2038) appears if the dependencies are not set correctly. Also, a linking warning regarding debug information might appear when the libraries are not built using Debug information (/MD instead of /MDd see point 2.). You may ignore this warning.
Linking warning and errors regarding “machine type 'x64' conflicts with target machine type 'x86'”. The whole solution should use 32-bit target platform settings. In general, you cannot mix 32-bit and 64-bit projects.
When I build the project, I get an error about cannot opening the lib file. How do I fix this?
.gitignore
files.When I run AutoTester, I get "Could not find pdf. AutoTester.exe was built with /DEBUG:FASTLINK which requires object files for debugging." How do I fix this?
Conflicts with the .vs
directory is causing this. Make sure that .vs
is ignored properly and not copied across machines.
Avoid using file syncing software like Dropbox or OneDrive and use git.