AnsweredAssumed Answered

creating header in a project

Question asked by medina.edgar on Apr 1, 2014
Latest reply on Apr 1, 2014 by Clive One
Hello everybody, I have a problem in a project, I want to compilate a code, it has worked correctly in another project ( but the another project is not mine), the code is a simple delay. Here is the body of my code.

delay.h:

#include "stm32f4xx.h"
line 3: void Delay_ms(unsigned long int nCount);
line 4: void Delay_us(unsigned long int nCount);

delay.c:
#include "delay.h"
unsigned int D;
void Delay_ms(unsigned long int nCount)
{     
  D=23999;
  while(nCount!=0){D--;if(D==0){D=23999;nCount--;}}
}
void Delay_us(unsigned long int nCount)
{     
  D=24;
  while(nCount!=0){D--;if(D==0){D=24;nCount--;}}
}
And the MAIN.C code:

#include "stm32f4xx.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_adc.h"
#include <stdio.h>
#include "delay.h"
...
void adc_configure(){...}
void usart_configure(){...}
void GPIO_configure(){...}

int main(void) {
...     
...
  Delay_us(10);
     while(1)
     {
               Delay_ms(250);
               ...
               Delay_ms(250);
               ...
     }
}

My code is very large and have others problems, but Why I have this error? or How I could solve that?
 read the part about the delay in the build output, because the others error are similar, I have other code, but different project and In that project the code compile without any error :S

Thanks.

Build target 'TFT'
compiling Main.C...
delay.h(3): error:  #130: expected a "{"
MyTFT1963.h(19): warning:  #12-D: parsing restarts here after previous syntax error
MyTFT1963.h(20): warning:  #177-D: variable "X" was declared but never referenced
MyTFT1963.h(21): warning:  #177-D: variable "Y" was declared but never referenced
MyTFT1963.h(22): error:  #77-D: this declaration has no storage class or type specifier
MyTFT1963.h(22): error:  #77-D: this declaration has no storage class or type specifier
MyTFT1963.h(197): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(198): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(199): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(200): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(201): error:  #757: variable "pPoint" is not a type name
Main.C(149): error:  #20: identifier "myTouch" is undefined
Main.C(149): error:  #20: identifier "PREC_EXTREME" is undefined
compiling AsciiLib.c...
AsciiLib.c(4): error:  #130: expected a "{"
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(8): warning:  #174-D: expression has no effect
AsciiLib.c(10): error:  #65: expected a ";"
AsciiLib.c(10): error:  #29: expected an expression
AsciiLib.c(568): warning:  #12-D: parsing restarts here after previous syntax error
AsciiLib.c(568): error:  #65: expected a ";"
AsciiLib.c(1180): error:  #20: identifier "ASCII16x24" is undefined
AsciiLib.c(1182): error:  #247: function "GetASCIICode6" has already been defined
compiling delay.c...
compiling MyTFT1963.c...
delay.h(3): error:  #130: expected a "{"
MyTFT1963.h(19): warning:  #12-D: parsing restarts here after previous syntax error
MyTFT1963.h(20): warning:  #177-D: variable "X" was declared but never referenced
MyTFT1963.h(21): warning:  #177-D: variable "Y" was declared but never referenced
MyTFT1963.h(22): error:  #77-D: this declaration has no storage class or type specifier
MyTFT1963.h(22): error:  #77-D: this declaration has no storage class or type specifier
MyTFT1963.h(197): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(198): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(199): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(200): error:  #757: variable "pPoint" is not a type name
MyTFT1963.h(201): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(140): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(191): warning:  #223-D: function "Delay_ms" declared implicitly
MyTFT1963.c(297): error:  #20: identifier "LCD_REG" is undefined
MyTFT1963.c(302): error:  #20: identifier "LCD_RAM" is undefined
MyTFT1963.c(307): error:  #20: identifier "LCD_REG" is undefined
MyTFT1963.c(308): error:  #20: identifier "LCD_RAM" is undefined
MyTFT1963.c(355): error:  #20: identifier "LCD_RAM" is undefined
MyTFT1963.c(968): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(986): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(989): warning:  #174-D: expression has no effect
MyTFT1963.c(989): error:  #65: expected a ";"
MyTFT1963.c(1006): error:  #20: identifier "First" is undefined
MyTFT1963.c(1010): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(1017): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(1023): error:  #757: variable "pPoint" is not a type name
MyTFT1963.c(1028): error:  #757: variable "pPoint" is not a type name
Target not created

Outcomes