hxx преди 3 години
ревизия
c139f235ca
променени са 5 файла, в които са добавени 38 реда и са изтрити 0 реда
  1. 2 0
      .gitignore
  2. 9 0
      CMakeLists.txt
  3. 9 0
      include/test.h
  4. 11 0
      src/main.cpp
  5. 7 0
      src/test/test.cpp

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+/build
+/bin

+ 9 - 0
CMakeLists.txt

@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.0.0)
+project(ACISAPI VERSION 0.1.0)
+set(CMAKE_CXX_COMPILER "g++") #设置c++编译器
+ 
+include_directories(${PROJECT_SOURCE_DIR}/include) #添加头文件的搜索路径
+aux_source_directory(${PROJECT_SOURCE_DIR}/src source_list) #将源文件列表写在变量SrcFiles中
+aux_source_directory(${PROJECT_SOURCE_DIR}/src/test source_list) #工程项目较大,要创建多个模块
+set(EXECUTABLE_OUTPUT_PATH  ${PROJECT_SOURCE_DIR}/bin) #设置可执行文件输出路径
+add_executable(main ${source_list}) #设置可执行文件的名称,make之后bin目录下出现main.exe

+ 9 - 0
include/test.h

@@ -0,0 +1,9 @@
+
+#ifndef _TEST_h_
+#define _TEST_H_
+ 
+#include <iostream>
+using namespace std;
+void myprint();
+
+#endif

+ 11 - 0
src/main.cpp

@@ -0,0 +1,11 @@
+
+//main.cpp
+#include <iostream>
+#include "test.h"
+ 
+int main(int argc, char** argv)
+{
+    myprint();
+    system("pause");
+    return 0;
+}

+ 7 - 0
src/test/test.cpp

@@ -0,0 +1,7 @@
+//test.cpp
+#include "test.h"
+ 
+void myprint()
+{
+    std::cout<<"myprint.\n";
+}