From 92b3385dbf39d15a60073586e2177e0d390aa68e Mon Sep 17 00:00:00 2001 From: Ryan Lau <47727459+ryanlau@users.noreply.github.com> Date: Sun, 1 Sep 2024 23:52:38 -0400 Subject: [PATCH 1/2] +lab1 p1 and p2 --- ryanlau/lab1_hard_project/CMakeLists.txt | 12 ++++++++++++ ryanlau/lab1_hard_project/include/hello_world.h | 9 +++++++++ ryanlau/lab1_hard_project/src/hello_world.cpp | 6 ++++++ ryanlau/lab1_hard_project/src/main.cpp | 7 +++++++ ryanlau/lab1_medium_project/CMakeLists.txt | 8 ++++++++ ryanlau/lab1_medium_project/src/main.cpp | 6 ++++++ 6 files changed, 48 insertions(+) create mode 100644 ryanlau/lab1_hard_project/CMakeLists.txt create mode 100644 ryanlau/lab1_hard_project/include/hello_world.h create mode 100644 ryanlau/lab1_hard_project/src/hello_world.cpp create mode 100644 ryanlau/lab1_hard_project/src/main.cpp create mode 100644 ryanlau/lab1_medium_project/CMakeLists.txt create mode 100644 ryanlau/lab1_medium_project/src/main.cpp diff --git a/ryanlau/lab1_hard_project/CMakeLists.txt b/ryanlau/lab1_hard_project/CMakeLists.txt new file mode 100644 index 0000000..1ea28a1 --- /dev/null +++ b/ryanlau/lab1_hard_project/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15...3.30) + +project( + HW1_PART2 + VERSION 1.0 + LANGUAGES CXX) + +add_library(HelloWorldLib src/hello_world.cpp include/hello_world.h) + +add_executable(HelloWorld src/main.cpp) + +target_link_libraries(HelloWorld PRIVATE HelloWorldLib) diff --git a/ryanlau/lab1_hard_project/include/hello_world.h b/ryanlau/lab1_hard_project/include/hello_world.h new file mode 100644 index 0000000..97bab6d --- /dev/null +++ b/ryanlau/lab1_hard_project/include/hello_world.h @@ -0,0 +1,9 @@ +#ifndef HELLOWORLD_H +#define HELLOWORLD_H + +class HelloWorld { + public: + void hello(); +}; + +#endif diff --git a/ryanlau/lab1_hard_project/src/hello_world.cpp b/ryanlau/lab1_hard_project/src/hello_world.cpp new file mode 100644 index 0000000..57e6bec --- /dev/null +++ b/ryanlau/lab1_hard_project/src/hello_world.cpp @@ -0,0 +1,6 @@ +#include +#include "../include/hello_world.h" + +void HelloWorld::hello() { + std::cout << "Hello, World!\n"; +} diff --git a/ryanlau/lab1_hard_project/src/main.cpp b/ryanlau/lab1_hard_project/src/main.cpp new file mode 100644 index 0000000..082b2a1 --- /dev/null +++ b/ryanlau/lab1_hard_project/src/main.cpp @@ -0,0 +1,7 @@ +#include "../include/hello_world.h" + +int main() { + HelloWorld h; + h.hello(); + return 0; +} diff --git a/ryanlau/lab1_medium_project/CMakeLists.txt b/ryanlau/lab1_medium_project/CMakeLists.txt new file mode 100644 index 0000000..386fa8e --- /dev/null +++ b/ryanlau/lab1_medium_project/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15...3.30) + +project( + HW1_PART1 + VERSION 1.0 + LANGUAGES CXX) + +add_executable(HelloWorld src/main.cpp) diff --git a/ryanlau/lab1_medium_project/src/main.cpp b/ryanlau/lab1_medium_project/src/main.cpp new file mode 100644 index 0000000..a84136b --- /dev/null +++ b/ryanlau/lab1_medium_project/src/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() +{ + std::cout << "Hello, World!\n"; +} From 4998bed63ebbe8d14d7deb09d039499efe4f6b66 Mon Sep 17 00:00:00 2001 From: Ryan Lau <47727459+ryanlau@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:19:44 -0400 Subject: [PATCH 2/2] include path fixes --- ryanlau/lab1_hard_project/CMakeLists.txt | 3 ++- ryanlau/lab1_hard_project/src/hello_world.cpp | 2 +- ryanlau/lab1_hard_project/src/main.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ryanlau/lab1_hard_project/CMakeLists.txt b/ryanlau/lab1_hard_project/CMakeLists.txt index 1ea28a1..76eab66 100644 --- a/ryanlau/lab1_hard_project/CMakeLists.txt +++ b/ryanlau/lab1_hard_project/CMakeLists.txt @@ -5,7 +5,8 @@ project( VERSION 1.0 LANGUAGES CXX) -add_library(HelloWorldLib src/hello_world.cpp include/hello_world.h) +add_library(HelloWorldLib src/hello_world.cpp) +target_include_directories(HelloWorldLib PUBLIC include) add_executable(HelloWorld src/main.cpp) diff --git a/ryanlau/lab1_hard_project/src/hello_world.cpp b/ryanlau/lab1_hard_project/src/hello_world.cpp index 57e6bec..56b51c3 100644 --- a/ryanlau/lab1_hard_project/src/hello_world.cpp +++ b/ryanlau/lab1_hard_project/src/hello_world.cpp @@ -1,5 +1,5 @@ +#include "hello_world.h" #include -#include "../include/hello_world.h" void HelloWorld::hello() { std::cout << "Hello, World!\n"; diff --git a/ryanlau/lab1_hard_project/src/main.cpp b/ryanlau/lab1_hard_project/src/main.cpp index 082b2a1..eecd6c8 100644 --- a/ryanlau/lab1_hard_project/src/main.cpp +++ b/ryanlau/lab1_hard_project/src/main.cpp @@ -1,4 +1,4 @@ -#include "../include/hello_world.h" +#include "hello_world.h" int main() { HelloWorld h;