in Education by
I have a (still) small game engine in C++ built with Visual Studio. The game engine has support for DirectX and OpenGL, but that's not really of importance. The important part is that I have some specific implementations of abstract base classes (for example, a DXKernel and an OGLKernel as subclasses of the Kernel class). So, the DXKernel and OGLKernel class have a common interface with some platform-specific code. The Kernel class does have some implementations of itself, so it's not a pure interface and these methods should be inherited by the implementations. Now, from what I understand, it's best to take the specific implementation out of the main project and create static libraries to link the main project with, depending on the platform I'm compiling for. So, if I'm compiling for OS X, I only want to include the OpenGL implementations. If I'm compiling for Windows, I want to include both the DirectX and OpenGL implementations. The Visual Studio layout now looks like this: Solution Project Header files Core DX DXKernel.h <-- DirectX implementation of abstract methods ... OGL OGLKernel.h <-- OpenGL implementation of abstract methods ... Kernel.h <-- abstract class(es) ... ... Source files Core DX DXKernel.cpp ... OGL OGLKernel.cpp ... Kernel.cpp ... ... If I create a new static library project in Visual Studio, and copy over the specific files to the new library, how can I get the library project to find the common headers (so for example Kernel.h)? Should I copy over the header files of the main project to the library (this creates problems as the headers are updated)? Should I change the include path on the library project? It seems though that this setup creates some kind of a circular dependency between the main project and the libraries, and that shouldn't be the case as far as I know. I hope you can help me out. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Let me answer my own question. I have done some more research on the topic and found out that static libraries require that the used headers are in the main project, while the .cpp implementations of these headers are in the static library. So, the source of the project now looks like this: Solution Main Project Header files Core DX DXKernel.h <-- DirectX header ... OGL OGLKernel.h <-- OpenGL header ... Kernel.h <-- abstract class ... ... Source files Core Kernel.cpp ... ... Static library project (DirectX) Source files Core DXKernel.cpp <-- DirectX implementation ... Static library project (OpenGL) Source files Core OGLKernel.cpp <-- OpenGL implementation ... All the source now builds correctly and I can choose which library the compiler should link with (or both of course). Thanks for watching.

Related questions

0 votes
    I have a (still) small game engine in C++ built with Visual Studio. The game engine has support for DirectX ... looks like this: Solution Project Header files Core DX DXKernel.h...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    What experience can you share about using multiple AJAX libraries? There are useful features in Prototype, some ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    I am trying to write a program that reads data from hundreds of YAML files repetitively and stores certain ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have a task coming up where I have to manually enter an HKEY_USER key value and string value for ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    I have one column in my table which will store data in string format the sample data is {"pre- ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I think I shall reframe my question from Where should you use BlockingQueue Implementations instead of Simple Queue ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
    Which operator is used by Java run time implementations to free the memory of an object when it is no ... questions and answers pdf, java interview questions for beginners...
asked Oct 26, 2021 in Education by JackTerrance
0 votes
    Hardware RAID implementations permit _________ that is, faulty disks can be removed and replaced by new ones ... in division Storage and File Structures of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    I'm trying to formulate how to write one regex to match this: I would like to write a regex to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I'm trying to formulate how to write one regex to match this: I would like to write a regex to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I'm trying to formulate how to write one regex to match this: I would like to write a regex to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Crashpad is an error reporting system for c++ apps. https://chromium.googlesource.com/crashpad/crashpad/+/ ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I'm trying to embed python into a C application. For the moment, I am trying to get the following ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I'm a beginner with RTEMS and I have built a RTEMS5 environment for an erc32 chip (the example in ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I want to compress some files (into the ZIP format) and encrypt them if possible using C#. Is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
...