0

hey guys i m finding it difficult to link the different files together in c..
here is my code...

//main.c
#include <stdio.h>
#include "other.h"

int main (void)
{
    printf("%d\n", getfavorite());

    return 0;
}
//other.h
#ifndef _OTHER_H
#define _OTHER_H
int getfavorite(void);
#endif
//other.c
#include "other.h"

int getfavorite (void)
{
    return 3;
}

but it always shows me this error...
Linker Error: Undefined Symbol getfavorite() in module MAIN.C

can nyone plz help me out in this..i m using Turbo c++...

Edited by Nick Evan: fixed closing tag

2
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
0

what compiler and/or IDE are you using and what operating system ? How to link two or more *.c object files will depend on the compiler and/or IDE.

0

i m using turbo c++ and windows xp....can u plz tell me looking at ma code that why is it showing that error....

0

i did the same thing...but still showing the same error....can u just tell me a step by step procedure..plzz...

0

>>can u just tell me a step by step procedure..plzz...
Nope -- I can't help you with that because I don't use that ancient crappy compiler. Its possible the version of the compiler you have doesn't support multiple files.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.