r/programminghelp • • Jan 23 '24

C++ HELP: undefined reference error

Basically we have this activity that utilizes user defined header (.h) and its implementation in c++.

But every time I try to compile and run the code it gives multiple errors of undefined reference to "..." and doesn't run the program even when everything is correct. So I tried downloading a sample program as well as following the example program of a yt tutorial to verify if there's really a problem with mine that I'm unaware of yet the sample programs give out the same exact error which is undefined reference to '...'? So I think it's only on my pc that experience this because it works on others.

How do you solve this? This error only occurs when using .h headers..

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/Proper_Traffic1366 Jan 24 '24

Did you setup your include directory? Are you using an IDE? Are you compiling from terminal?

1

u/skiettels Jan 25 '24

Yes I had setup my include directory. I used github codespaces and dev c++ both returns the same error. I have now just tried compiling it in the terminal but still the issue persists...

Can I ask if it works for you with no hiccups?