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; }