natinusala / borealis

Hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx)
Apache License 2.0
267 stars 84 forks source link

CLion: Allocating an object of abstract class type 'brls::TabFrame' unimplemented pure virtual method 'draw' in 'TabFrame' #45

Closed TheLukeGuy closed 4 years ago

TheLukeGuy commented 4 years ago

I've been trying to use Borealis with JetBrains's CLion IDE, but when I try creating a new TabFrame, CLion gives the following error:

image

Allocating an object of abstract class type 'brls::TabFrame' unimplemented pure virtual method 'draw' in 'TabFrame'

CLion uses CMake (specifically CMake 3.17 with the version of CLion that I'm using) to resolve all of the includes, and I do include Borealis in the CMakeLists.txt file, but I'm using a traditional Makefile to actually compile the code. The code does compile fine with make, but that error in CLion is annoying nonetheless. I'm using the latest beta version of CLion 2020.2.

Here's the full code:

#include <borealis.hpp>

int main() {
    brls::Logger::setLogLevel(brls::LogLevel::DEBUG);

    if (!brls::Application::init("Howl")) {
        brls::Logger::error("Failed to initialize Borealis application.");
        return EXIT_FAILURE;
    }

    brls::TabFrame *rootFrame = new brls::TabFrame();
}

And here's the CMakeLists.txt file (which, again, I don't actually use to compile the code with, but CLion uses it to resolve the includes):

cmake_minimum_required(VERSION 3.17)
project(HowlNX)

set(CMAKE_CXX_STANDARD 17)

include_directories($ENV{DEVKITARM}/include)
include_directories($ENV{DEVKITPRO}/libnx/include)
include_directories(borealis/library/include)

add_executable(HowlNX source/main.cpp)
natinusala commented 4 years ago

I would say that CMake doesn't see the .cpp files, and it thinks the methods are left unimplemented. You need to add the actual source code to fix that IMO

Also this is not really an issue with Borealis because we don't support CMake, so I'm closing the issue. I'll help you the best I can but my CMake knowledge is limited

TheLukeGuy commented 4 years ago

Thanks for the quick reply! I tried adding all of the Borealis .cpp files with CMake, but the same error still occurs. Here's the updated CMakeLists.txt file:

cmake_minimum_required(VERSION 3.17)
project(HowlNX)

set(CMAKE_CXX_STANDARD 17)

include_directories($ENV{DEVKITARM}/include)
include_directories($ENV{DEVKITPRO}/libnx/include)
include_directories(borealis/library/include)

file(GLOB_RECURSE sources *.cpp)

add_executable(HowlNX ${sources})

I can confirm that did indeed add all of the Borealis source files because CLion changes the icon next to the name of all added source files.

natinusala commented 4 years ago

Well then I have no idea, sorry :shrug:

TheLukeGuy commented 4 years ago

Ah okay, all good. Thanks for trying, anyway!