g++ compiler does not include header file

Hi

I am using g++ to compile on a raspberry pi.

using the following the project compiles:

g++ -c file1.cpp file2.ccp .....filen.cpp

however using the following:

g++ -o exefile file1.cpp file2.ccp .....filen.cpp

I get numerous messages as follows:

filen.cpp: (.text+0xb73c): undefined reference to `*******
etc etc etc

these functions are defined in a header file in each of the file*.cpp files thus:


#include "funcdefs.h"

this header file is located in the same directory as the *.cpp files

the header file was originally entitled FUNCDEFS.H but I changed the name to lower case funcdefs.h to stop the compiler complaining.

the funcdefs file contains the following code:


1
2
3
4
5
6
7
8
9
10
11
//#if !defined(FUNCDEFS_H)
//#define FUNCDEFS_H

#if !defined(funcdefs_h)
#define funcdefs_h
 
extern double func1 ( double f ) ;
extern void func2 ( double *input ) ;
//etc etc etc

#endif 


I have tried making the preprocessor directive in the funcdefs.h file lower case (didn't make any difference) and have checked the include path using -H and it seems to find the file but cannot get it to link.

Any ideas?

Thanks
Last edited on
> these functions are defined in a header file
your header file contains declarations, no definitions
Topic archived. No new replies allowed.