cancel
Showing results for 
Search instead for 
Did you mean: 

cannot call a class from my own header file

mohamad_armoon
Associate III
Posted on February 28, 2014 at 14:19

hi guys, i create a header file , means a .cpp and a .h file .

but when i attach this file in my project in IAR compiler , it doesn't work, i mean i cannot access to my class in header file

here is my code :

SPI.h:

&sharpinclude <stdint.h>

&sharpifndef SPI_H_

&sharpdefine SPI_H_

class spi{

spi(int SPI_Num);

void SPI1_Set(uint16_t ,uint16_t ,uint16_t );

void SPI2_Set(uint16_t ,uint16_t ,uint16_t );

};

&sharpendif

SPI.cpp:

 void spi::SPI1_Set(uint16_t spi_mode,uint16_t spi_direction,uint16_t spi_baudrateprescaler)

 {

......

 }

void spi::SPI1_Set(uint16_t spi_mode,uint16_t spi_direction,uint16_t spi_baudrateprescaler)

 {

 .......

 }

#master #spi #discovery #stm32f4
2 REPLIES 2
chen
Associate II
Posted on February 28, 2014 at 15:24

Hi

''it doesn't work, i mean i cannot access to my class in header file''

Please can you give the exact error from the compiler/linker?

Your problem could be a number of things - we need the compiler/linker output to understand

benjaminguillot.699
Associate II
Posted on February 28, 2014 at 15:29

#include <spi.h>

in the .cpp ??