Answer the question
In order to leave comments, you need to log in
How to compile a project if it uses an object of a class that does not yet exist (C++, I am writing a library)?
I want to make it so that in my library, for easier work with DirectX graphics, instead of the main function, the MainScene class with several basic methods is used, but the problem is that I cannot use it in the library, since it has not yet been created at the moment compilation, but it will be created when the library is connected to the project. How can this problem be solved?
Answer the question
In order to leave comments, you need to log in
Firstly, the main function in the library cannot be, the library is just an extension of the functionality for the project in which it will be used. Main - serves as a starting point for executable applications, if not strongly perverted, and therefore should only be defined in the project that is going to be executable.
Second, what's the problem with MainScene? You simply create a base class interface , then use it by getting a pointer to the object of its implementation, you just need to give the user the opportunity to send this pointer to you through some library function.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question