1

I just begin new project in eclipse. Try to use C-library from C++ file. In headers, where are prototypes of functions, here is:

#ifdef __cplusplus
 extern "C" {
#endif

// prototypes...
void Init_Configuration(void);

#ifdef __cplusplus
}
#endif

It's initialize.h. In main.cpp i include this file and try use function:

#include "initialize.h"

int main()
{
    Init_Configuration();

    // Life cycle
    while (1)
    {

    }
}

After compilation i get this error:

initialize.c:54: undefined reference to `SPI_Cmd'

In source C file "initialize.c", where i also include "initialize.h" i use function from C-library for stm32f2xx:

#include "initialize.h"
#include "stm32f2xx_rcc.h"
#include "stm32f2xx_spi.h"
#include "stm32f2xx_gpio.h"

// some code
SPI_Cmd(SPI1, DISABLE);
// some code

In this library also is this code:

#ifdef __cplusplus
 extern "C" {
#endif
...

I don't know where a problem. Please, help!

old_timer
  • 69,149
  • 8
  • 89
  • 168

0 Answers0