HELP undeclared here (not in a function)

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I am designing a system in Rhapsody.

For preference purposes, I am creating each file as an "object" in Rhapsody, which means

that all the variables in that file are packed in a structure that is unique for each file.

I make this for easier visibility for myself.

the problem is that this "object" element doesn't allow me to create macros within the tool,

so I have to create an extra file into the design, that holds the macros.

 

For an unknown reason (for me), I keep getting this error:

 

'NUMAR_TASKURI_CONFIG' undeclared here (not in a function)

 

in the file "SchedulerTaskConfig.h" which looks like (just  ignore the comments...they are mixed with c++ terminology, but the code has no trace of c++):

#ifndef SchedulerTaskConfig_H
#define SchedulerTaskConfig_H

/*## auto_generated */
#include "Scheduler_Pkg.h"


/*## dependency SpalatorFar_SPKg */
#include "SpalatorFar_SPKg.h"


/*## package Scheduler_Pkg */

/*## class TopLevel::SchedulerTaskConfig */


/*## type task_t */
typedef struct task_t {
    /* Pointer to the task function */
    void (*task)(void);		/*## attribute (*task)(void) */
    /* Initial delay of the task in Ticks */
    long delay;		/*## attribute delay */
    /* The period of the task in Ticks */
    long period;		/*## attribute period */
} task_t;



struct SchedulerTaskConfig_t {
    task_t tasks[NUMAR_TASKURI_CONFIG];		/*## attribute tasks */  <---------This is the line that generates the error.
};

/***    User implicit entries    ***/





/*## operation Init() */
void SchedulerTaskConfig_Init(void);

/***    User explicit entries    ***/


/* Operations */

/* Argument void (*function_pointer)(void) : */
/* Pointer to function */
/*## operation CreateTask(void (*)(void),long,long) */
void SchedulerTaskConfig_CreateTask(void (*function_pointer)(void), long period, long delay);


/*## operation Task_10ms() */
void SchedulerTaskConfig_Task_10ms(void);



#endif

The

NUMAR_TASKURI_CONFIG

 is a macro that is defined within "SchedulerConfigTaskNO.h" which looks like this:

#ifndef SchedulerConfigTaskNO_H
#define SchedulerConfigTaskNO_H

/*## auto_generated */

#include "Scheduler_Pkg.h"

/*## package Scheduler_Pkg */

/*## class TopLevel::SchedulerConfigTaskNO */
/* to be manually edited as number of tasks increases. */
/*## attribute NUMAR_TASKURI_CONFIG */
#define NUMAR_TASKURI_CONFIG 1//temporar setat 1

/***    User explicit entries    ***/


#endif

and is included by "Scheduler_Pkg.h" as follows:

#ifndef Scheduler_Pkg_H
#define Scheduler_Pkg_H

/*## classInstance Scheduler */
#include "Scheduler.h"
/*## file SchedulerConfigTaskNO */
#include "SchedulerConfigTaskNO.h"
/*## classInstance SchedulerHwConfig */
#include "SchedulerHwConfig.h"
/*## classInstance SchedulerTaskConfig */
#include "SchedulerTaskConfig.h"
/*## package Scheduler_Pkg */


/*## classInstance Scheduler */
extern struct Scheduler_t Scheduler;


/* The system atomic time base will be 1ms. */
/*  */
/*## classInstance SchedulerHwConfig */
extern struct SchedulerHwConfig_t SchedulerHwConfig;


/*## classInstance SchedulerTaskConfig */
extern struct SchedulerTaskConfig_t SchedulerTaskConfig;


/*## auto_generated */
void Scheduler_Pkg_initRelations(void);

#endif

which at it's turn is included by "SchedulerTaskConfig.h", see the first piece of code.

 

Can anyone tell me what is wrong with this?and also keep in mind that the "NUMAR_TASKURI_CONFIG" macro has to remain in the "SchedulerConfigTaskNO.h" file?

 

Thank you in advance and sorry if this is a dumb question.

Victor.

This topic has a solution.
Last Edited: Thu. Sep 25, 2014 - 01:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think I should remove the comments since they make the readability impossible.

I will do this in the evening when I get back home, and re-post the code improved for readability.

 

P.S.

I have edited the code a little on the previous post, so it is now a little bit more visible.

Hope someone can help.

I also am using this method in other files that don't generate this error.

 

Last Edited: Thu. Sep 25, 2014 - 01:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you cut the project down to the smallest possible that still builds with that error, and then ZIP it up and post the whole thing as an attachement here?

 

This sounds like a case where we can solve it if we can get your project and play around with it.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
#ifndef SchedulerConfigTaskNO_H
#define SchedulerConfigTaskNO_H

/*## auto_generated */

#include "Scheduler_Pkg.h"

Remove this include of Scheduler_Pkg.h (or move the #define above this line).
/Lars

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, and thank you for your hints.

 

Lars, your solution worked, but I don't understand why, since all the specification files (*.h) are guarded.

 

Do you have also an explanation?

 

Johan, If you are curious, I can provide all the project, it is small.

 

Thank you both for your efforts.

Have a nice evening,

Victor.

Last Edited: Thu. Sep 25, 2014 - 08:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lars, your solution worked, but I don't understand why

 

Then run the compiler so that it produces the preprocessed output. Do this both without and with Lars advised change. Study the differences in the preprocessed sources. All will likely become clear.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Thu. Sep 25, 2014 - 08:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to add to what Johan says possibly the easiest way to do that is add -save-temps to the compilation then after building every .c will leave behind a .i and a .s file. The .i files are the preprocessed source.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks freaks for the valuable information.

I will now set this thread as solved and I will eventually come back if I I encounter problems with this experiment.