Skip to content

Commit a9be5d2

Browse files
Adding library
1 parent f804cb3 commit a9be5d2

File tree

10 files changed

+40
-0
lines changed

10 files changed

+40
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vscode
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

course/3/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
3+
project(HelloWorldProject VERSION 1.0.0)
4+
5+
add_library(
6+
HelloLibrary
7+
hello-library.hpp
8+
hello-library.cpp
9+
)
10+
11+
add_executable(HelloApp main.cpp)
12+
13+
target_link_libraries(HelloApp PRIVATE HelloLibrary)

course/3/build/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

course/3/hello-library.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "hello-library.hpp"
2+
#include <iostream>
3+
4+
void HelloLibrary::showHello()
5+
{
6+
std::cout<<"Hello world"<<std::endl;
7+
}

course/3/hello-library.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef HELLO_LIBRARY_HPP
2+
#define HELLO_LIBRARY_HPP 1
3+
4+
namespace HelloLibrary
5+
{
6+
void showHello();
7+
}
8+
9+
#endif

course/3/main.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <iostream>
2+
#include "hello-library.hpp"
3+
4+
int main()
5+
{
6+
HelloLibrary::showHello();
7+
return 0;
8+
}

0 commit comments

Comments
 (0)