Aug 23

Setting up the Windows Console project

:Basic file structure for XPat project


Example diagram:




Theoretical Background:


In this article we will create a Windows Console App that takes a project dependency on our CrossPlatformProjectExampleCore static library project.

This console app that we will be creating will be used just as a playground to use our code and mess around with the code, as it runs on windows it is very fast to test new features or small things.


This console app project we are about to create is not mandatory in order to create and write our cross platform code, it is used simply because it is more comfortable to test using a console app, it is not even ment to replace our cross platform tests, as we will use gtest and gmock in order to do so.

It should simply be treated as a playground which makes our development life easier.


Setting up the project:


We will repeat the steps we have done in the previous article about creating the CrossPlatformProjectExampleCore. (Please refer to that article for detailed steps)


1. Add the inc folder to our project path (The same inc folder as we did in the previous article)


2. Set the project to use the pch file

We will create a different pch file and name is: console-app-pch.

The console-app-pch.cpp and the console-app-pch.h will both be in the directory of our console app windows project, as they are not related to the cross platform.


3. Set the console-app-pch.cpp to generate the pch file. (The same as we did in the previous article but with the new console-app-pch.cpp)


4. Set to auto include the console-app-pch.h to all our cpp files. (The same as we did in the previous article)


5. Set our console app to take a project dependency on our core app (This is a new step)



Now when we build the project it will build our console app, it will take a dependency upon the CrossPlatformProjectExample project and we will be able to test our code.
And under our CrossPlatformProjectExample solution folder, under Debug, it will generate our exe:



Link to download the example project


That is it,


In the next article I will go over how we test our cross platform code.
Creating a testing project that will use gtest and gmock and use our common core static library in order to test our code.


Good luck !

Leave a Reply

Your email address will not be published.

אתם יכולים להשתמש באפשרויות ותגי ה-HTMLהבאים: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>