Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22177

"undefined reference" error when using c header files [duplicate]

$
0
0

I have three files: main.c, location.c and location.h. They can't seem to compile.

Here are my source files. main.c:

#include <stdio.h>
#include "location.h"

int main() {
    executeLook();
    return 0;
}

location.c:

#include <stdio.h>

void executeLook() {
    print("Hello World");
}

location.h:

extern void executeLook();

On compiling the CodeBlocks(gcc compiler) compiler gives the following error:

c:\mingw\bin\..\lib\gcc\mingw32\8.2.0\..\..\..\..\mingw32\bin\ld.exe: I:\Test Program\main.o: main.c|| undefined reference to `executeLook'|

Anyone able to help me out? I'm really stuck on this.


Viewing all articles
Browse latest Browse all 22177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>