c++ error: out-of-line definition of 'function' does not match any declaration in 'Class'

Viewed 35

I'm trying to create my own Core class in CLion, the app run on a Docker Container :

core.h

#ifndef ARCADIA_CORE_H
#define ARCADIA_CORE_H

#include <QtCore>

class Core {
public:
    Core();
    QLocale getCurrentLocale();

private:
     QLocale currentLocale;

    // Available Languages
    const QList<QLocale> locales = {QLocale::French, QLocale::English };
};


#endif //ARCADIA_CORE_H

core.cpp

#include <QtCore>
#include "core.h"

Core::Core(){
    
}

QLocale Core::getCurrentLocale() {
    return currentLocale;
}

CMakeList.txt

cmake_minimum_required(VERSION 3.0)

project(arcadia)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Core Widgets WebEngineWidgets Gui Quick)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_AUTOUIC_SEARCH_PATHS ui)

file(GLOB_RECURSE SRC_FILES src/*.cpp)
file(GLOB_RECURSE INCLUDE_FILES include/*.h)
file(GLOB_RECURSE UI_FILES ui/*.ui)

include_directories(include)

add_executable(arcadia application.qrc ${SRC_FILES} ${INCLUDE_FILES} ${UI_FILES})
target_link_libraries(arcadia PRIVATE Qt6::Core Qt6::Widgets Qt6::WebEngineWidgets Qt6::Gui Qt6::Quick)

But I have this error when building the project :

/home/dev/arcadia/src/core.cpp:8:7: error: 'Core' is missing exception specification 'noexcept'
Core::Core(){
      ^
             noexcept
/home/dev/arcadia/src/core.h:10:7: note: previous declaration is here
class Core {
      ^
/home/dev/arcadia/src/core.cpp:12:15: error: out-of-line definition of 'getCurrentLocale' does not match any declaration in 'Core'
QLocale Core::getCurrentLocale() {
              ^~~~~~~~~~~~~~~~
/home/dev/arcadia/src/core.cpp:13:12: error: use of undeclared identifier 'currentLocale'
    return currentLocale;
           ^
3 errors generated.

Here is my Docker-Compose

version: '3'

services:
  dev:
    build: # use the Dockerfile in the current directory
      context: .
      dockerfile: Dockerfile.arcadia-dev
    security_opt: # options needed for gdb debugging
      - seccomp:unconfined
      - apparmor:unconfined
    container_name: arcadia-dev
    ports:
      - "7776:22" # SSH
      - "7777:7777" # GDB Server
      - "5900:5900" # VNC
    volumes:
      - ${HOME}/.Xauthority:/home/dev/.Xauthority:rw # X11 stuff
      - /tmp/.X11-unix:/tmp/.X11-unix # X11 stuff
      - /dev/dri:/dev/dri #X11 stuff
      - /dev/snd:/dev/snd #X11 stuff

0 Answers
Related