Remove unused code and migrate to CMake build system.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 4.1)
|
||||
project(intro)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
||||
add_executable(intro main.cpp
|
||||
functions.cpp)
|
||||
@@ -0,0 +1,6 @@
|
||||
//
|
||||
// Created by David Hackbarth on 06.02.26.
|
||||
//
|
||||
#include "functions.h"
|
||||
|
||||
void functionE() {}
|
||||
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
//
|
||||
// Created by David Hackbarth on 06.02.26.
|
||||
//
|
||||
|
||||
#ifndef CPP_FUNCTIONS_H
|
||||
#define CPP_FUNCTIONS_H
|
||||
|
||||
void functionE();
|
||||
// void functionF() {}
|
||||
|
||||
#endif //CPP_FUNCTIONS_H
|
||||
@@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include "functions.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
void functionB() {
|
||||
}
|
||||
|
||||
void functionC(); // forward declaration
|
||||
void functionD(); // forward declaration
|
||||
|
||||
int main() {
|
||||
const char *lang = "C++";
|
||||
std::cout << "Hello and welcome to " << lang << "!\n";
|
||||
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
std::cout << "i = " << i << std::endl;
|
||||
}
|
||||
|
||||
// functionA(); // compiler error - function is defined after call
|
||||
functionB(); // no error - function is defined before call
|
||||
// functionC(); // linker error - function is declared but not defined
|
||||
functionD(); // no error - function is declared and defined
|
||||
functionE();
|
||||
// functionF(); // linker error - function is defined twice
|
||||
|
||||
// byte b;
|
||||
short s;
|
||||
int i;
|
||||
long l;
|
||||
long long ll;
|
||||
|
||||
cout << "size of short: " << sizeof(s) << endl;
|
||||
cout << "size of int: " << sizeof(i) << endl;
|
||||
cout << "size of long: " << sizeof(l) << endl;
|
||||
cout << "size of long long: " << sizeof(ll) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void functionA() {
|
||||
}
|
||||
|
||||
void functionD() {}
|
||||
Reference in New Issue
Block a user