I just startet with C++ and i don't know whats wrong with this Code I already saw the same problem in other questions but the sources are too complex
Main.cpp
#include <iostream>
#include <climits>
#include "print.h"
int z = 3;
int main()
{
std::cout << z << std::endl;
print();
return 0;
}
print.h
#ifndef PRINT_H_INCLUDED
#define PRINT_H_INCLUDED
void print();
#endif
print.cpp
#include <iostream>
extern int z;
void print(){
std::cout << z << std::endl;
std::cout << z << std::endl;
}
The Error is "undefined reference to print()" Does anyone have an idea how i can solve that?