0

I am doing an exercise. I need to run a simple C++ code in which I need to include a header file. I am using VS code on Mac. Indeed, I have the main file (use.cpp) with the code

#include "my.h" int foo = 7; int main(){ print_foo(); print(99); } and another file (my.cpp) with the code

#include "my.h" #include "std_lib_facilities.h" void print_foo() { cout << "The value of foo is "<< foo << '\n'; } void print(int i){ cout << "The value of i is " << i << '\n'; } and a header file (my.h) with the code extern int foo; void print_foo(); void print(int);

But when I run my.cpp it gives an error: clang: error: linker command failed with exit code 1 (use -v to see invocation)

I do not know what to do. Any help is appreciated.

enter image description here enter image description here enter image description here

0

You must log in to answer this question.

Browse other questions tagged .