I wrote three programs
this is main:
#include <stdio.h>
#include "head.h"
int main() {
printf("Hello, World!\n");
int z = mult(3,5);
printf("%d", z);
return 0;
this is head.h:
#ifndef EX0_HEAD_H
#define EX0_HEAD_H
int mult(int x, int y);
#endif //EX0_HEAD_H
this is head.c:
#include <stdio.h>
#include "head.h"
int mult(int x, int y)
{
int z = x*y;
return z;
and the cmake file:
cmake_minimum_required(VERSION 3.24)
project(ex0 C)
set(CMAKE_C_STANDARD 99)
add_executable(ex0 main.c head.c head.h)
i need to know why i got this error:
gcc.exe -o main "C:\Users\jonat\OneDrive\שולחן העבודה\c&c++\ex0\main.c"
C:\Program Files\JetBrains\CLion 2022.3.3\bin\mingw\bin/ld.exe: C:\Users\jonat\AppData\Local\Temp\ccsmetoW.o:main.c:(.text+0x78): undefined reference to `mult'
collect2.exe: error: ld returned 1 exit status