C ++构造函数未定义

时间:2019-03-11 12:41:17

标签: c++ cmake

我从事C ++项目,我使用CMake构建文件。我的构建失败原因

  

对`Software :: Software()'的未定义引用

,但我看不到问题。如果您有想法,请不要犹豫,谢谢

文件体系结构:

enter image description here

CMake:

# cmake_minimum_required(VERSION <specify CMake version here>)
project(untitled)

cmake_minimum_required(VERSION 2.8.9)
set(CMAKE_CXX_STANDARD 11)

include_directories(include)

file(GLOB SOURCES "src/*.cpp")
add_executable(untitled ${SOURCES})

Software.h:

#include <string>
class Software{
    private : 
        std::string name;

    public :
        Software();
}

Software.cpp:

#include "Software.h"

Software::Software() {
    this->name = "defaultName";
}

SoftwaresConfigurations.h(称为软件的构造者):

#include "Software.h"

class SoftwaresConfigurations {
    public:
        SoftwaresConfigurations();
}

SoftwaresConfiguration.cpp:

#include "SoftwaresConfigurations.h"

SoftwaresConfigurations::SoftwaresConfigurations(){
    Software software = Software();
}

0 个答案:

没有答案