Answer the question
In order to leave comments, you need to log in
Class is not defined in child file after include, why?
There are two files,
LicenseKey.h
#include "LicensesProduct.h"
namespace Machinarium {
namespace Licenses_System {
#warning "LICENSE_KEY Class creation"
class LicenseKey : IValidationInterface {
...
#include "LicenseKey.hpp"
#include "IValidationInterface.h"
namespace Machinarium {
namespace Licenses_System {
class LicensesProduct : public IValidationInterface, Machinarium::BaseClasses::Nameable {
private:
Cryptographic::CryptographicKeyPair cryptographicKeyPair;
LicenseKey activeLicense;
...
==== Building licenses (release) ====
LicenseKey.cpp
In file included from src/LicenseKey.cpp:1:
src/LicenseKey.hpp:11:4: warning: #warning "LICENSE_KEY Class creation" [-Wcpp]
11 | #warning "LICENSE_KEY Class creation"
| ^~~~~~~
In file included from src/LicenseKey.hpp:6,
from src/LicenseKey.cpp:1:
src/LicensesProduct.h:17:4: error: ‘LicenseKey’ does not name a type
17 | LicenseKey activeLicense;
Answer the question
In order to leave comments, you need to log in
Firstly, for some reason you have the extension h somewhere, and somewhere hpp. It needs to be brought to one.
Secondly, you have a cyclic include, this will not work. This must be decided. For example, you can solve with forward declaration and pimpl.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question