Dear friends:
i define a function "funtion1", i put the declaration in the "funtion1.h"

#ifndef FUNTION1_H_INCLUDED
#define FUNTION1_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
double funtion1(double ,double );
#endif // FUNTION1_H_INCLUDED

and write the function body in the file "funtion1.c"

The following is my main file, but when i compile it in codeblock, it gives me some error message " undefined reference to funtion1", what is your suggestions.

#include "funtion1.h"
int main()
{
   double aa,bb;
   aa=4.5;
   bb=5.4;

   funtion1(aa,bb);

    return 0;
}

You need to add each source file to the project (through the Codeblock's menus) and build them all together. Actually, it will cause each source file to be compiled individually, and then linked together.

If you want to gain a more complete understanding of this, you can read my tutorial about this.

yes, all the file is in the project. but it still gives me the "undefined reference error

You also have to make sure that the name and signature matches that of the header file, you have to have exactly this in the source file:

double funtion1(double ,double ) {
  // ... the code
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.