cancel
Showing results for 
Search instead for 
Did you mean: 

External source and header files

Heimatlos
Associate

Hello. 

I am currently trying to implement our architecture to STM32 but facing several issues. I have external header and source files. I added them from Paths and Symbols, Includes and Source Location respectively. I can reach header file but it looks like either header and source are not connected or project and source are not connected.

In main.c I added

struct examplestruct pM;

ExampleFunction(&pM);

In main.h I added

#include "ExternalHeader.h"

here is ExternalHeader.h

typedef struct examplestruct

{

int exampleint;

};

void inline ExampleFunction(struct examplestruct*);

here is ExternalSource.c

#include "ExternalHeader.h"

void inline ExampleFunction(struct examplestruct* pM)

{

pM->exampleint=1;

}

I am getting undefined reference to 'ExampleFunction' error and inline function 'ExampleFunction' declared but never defined errors.

I looked up some examples but sadly changing location of external files is a big no.

Here is the File Order

ProjectFolder

|STMProject

|ExternalFiles

     |HeaderF

           |ExampleHeader.h

     |SourceF

           |ExampleSource.h

Here are the errors.

Description Resource Path Location Type
make: *** [makefile:65: POC.elf] Error 1 POC C/C++ Problem

undefined reference to `ExampleFunction' main.c /POC/Core/Src line 104 C/C++ Problem

Here are the warnings.

Description Resource Path Location Type
inline function 'ExampleFunction' declared but never defined POC line 7, external location: C:\Users\heimat\Desktop\ProofOfConcept\ExternalFiles\HeaderF\ExternalHeader.h C/C++ Problem
useless storage class specifier in empty declaration POC line 4, external location: C:\Users\heimat\Desktop\ProofOfConcept\ExternalFiles\HeaderF\ExternalHeader.h C/C++ Problem

 

 

 

1 REPLY 1
gbm
Lead III

Remove inline attribute of your function. To be called from other module, a function cannot be inlined.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice