Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lab1 #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

lab1 #41

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Sayan/lab1_hard_project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.15...3.30)

project(
lab1Example
VERSION 1.0
LANGUAGES CXX)

add_library(HelloWorldlib STATIC src/hello_world.cpp include/hello_world.h)

target_include_directories(HelloWorldlib PUBLIC include)

# target_compile_features(HelloWorldlib PUBLIC cxx_std_11)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont include commented code


add_executable(main src/main.cpp)

target_link_libraries(main PUBLIC HelloWorldlib)
8 changes: 8 additions & 0 deletions Sayan/lab1_hard_project/include/hello_world.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
// #include <iostream>
Copy link
Contributor

@RCMast3r RCMast3r Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about includes


class hello_world
{
public:
void static write_hello_world();
};
7 changes: 7 additions & 0 deletions Sayan/lab1_hard_project/src/hello_world.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "/Users/sayandahiya/Desktop/Hytech/lab1_hard_project/include/hello_world.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please do not include header files like this, this is setup by cmake for you:

https://cliutils.gitlab.io/modern-cmake/chapters/basics.html#targets-are-your-friend

#include <iostream>

void hello_world::write_hello_world()
{
std::cout << "Hello World";
}
7 changes: 7 additions & 0 deletions Sayan/lab1_hard_project/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#include </Users/sayandahiya/Desktop/Hytech/lab1_hard_project/include/hello_world.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment about includes


int main()
{
hello_world::write_hello_world();
}