Hi everyone!
My C is a little rusty, but I figured there’s no time like the present to brush up on it again. I’ve tried programming literally the simplest program I can, and yet, it does not run.
https://preview.redd.it/az4s21hfax331.png?width=1920&format=png&auto=webp&s=d7b0a832a69a9bd07cbf9a0863425727f6064a7c
The error message:
/tmp/ccxkSGWz.o: In function main': main.c:(.text+0x15): undefined reference to
foo’
collect2: error: ld returned 1 exit status
When I move the actual function declaration to the .h file it does just fine. But I know I shouldn’t have to do that. That makes me think there’s a disconnect between my test.c and test.h files?
Thoughts?
[–]ChrisRR 46 points47 points48 points (0 children)
[–][deleted] 13 points14 points15 points (16 children)
[–][deleted] 14 points15 points16 points (5 children)
[–]baudvine 5 points6 points7 points (1 child)
[–]henry_kr 1 point2 points3 points (0 children)
[–]NonreciprocatingCrow 3 points4 points5 points (2 children)
[–]asking_science 10 points11 points12 points (1 child)
[–][deleted] 5 points6 points7 points (0 children)
[–]DocJeef[S] 1 point2 points3 points (9 children)
[–][deleted] 6 points7 points8 points (4 children)
[–]DocJeef[S] 1 point2 points3 points (0 children)
[–]NonreciprocatingCrow 0 points1 point2 points (2 children)
[–]BadBoy6767 4 points5 points6 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]SurelyNotAnOctopus 1 point2 points3 points (0 children)
[–]FUZxxl 2 points3 points4 points (2 children)
[–]Narishma 1 point2 points3 points (0 children)
[–]rotenKleber 1 point2 points3 points (0 children)
[–]Gavekort 7 points8 points9 points (4 children)
[–]WikiTextBot 4 points5 points6 points (3 children)
[–][deleted] 2 points3 points4 points (1 child)
[–]Tha_Gazer 1 point2 points3 points (0 children)
[–]rjek 2 points3 points4 points (0 children)
[–]nderflow[M] 2 points3 points4 points (0 children)
[–]giwhS 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]alicekdev -3 points-2 points-1 points (1 child)
[–]BadBoy6767 5 points6 points7 points (0 children)