Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

linking error with header files

$
0
0
Hey all,
I am still having trouble with some linking errors with user defined header files with the source code for my program.
The code that I am working on is an error display source file which has its definition in the source code, but uses a
header file with the function prototypes for the implemention in the program code.

and the error in which i keep getting is

TCPEchoClient4.c:(.text+0x38): undefined reference to `userError'
TCPEchoClient4.c:(.text+0xa5): undefined reference to `systemError'

The IDE in which i am using is geany

I know that I could use put everything in some single file and have it run but it is not good code practice,
and plus it cuts out on the code re-use ability and modulation.

This is the definition of the error displaying functions

/* DieWithMessage.c */
#include <stdio.h>
#include <stdlib.h>

void userError(const char *err, const char *detail){
	fputs(err, stderr);
	fputs("=> ", stderr);
	fputs(detail, stderr);
	fputc('\n', stderr);
	exit(1);
} // function

void systemError(const char *err){
	perror(err);
	exit(1);
} // function



and this is the the header which has the function prototypes
/* netlib.h */

#define BUFF_LENGTH 32

// DieWithMessage.c
void userError(const char *, const char *);
void systemError(const char *);


Viewing all articles
Browse latest Browse all 51036

Trending Articles



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