Clion cmake 一个简单的 C++ 程序

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(dll)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp dll.h dll.cpp)
add_executable(dll ${SOURCE_FILES} dll.h dll.cpp)

dll.h

#ifndef DLL_DLL_H
#define DLL_DLL_H
#endif

#pragma once
#include <iostream>

void hello(void);

dll.cpp

#include "dll.h"

void hello(void)
{
    std::cout<<"Hello from dll!\n"<<std::endl;
}

main.cpp

#include "dll.h"
#include <iostream>

using namespace std;

int main()
{
    hello();
    return 0;
}

360截图20160610205516272

posted @ 2016-06-10 20:56  佩雷尔曼的信徒  阅读(989)  评论(0编辑  收藏  举报