Symbol could not be resolved, but build successful

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Symbol could not be resolved, but build successful

Jump to solution
2,694 Views
hrvojeerjavec
Contributor III

Hello,

is there a way to have the code organized like this, such that the s32 doesn't generate errors? The error reported will be

Symbol 'INCREMENT_STEP' could not be resolved.

 

<<<main.c>>>

#ifndef MAIN_C_
#define MAIN_C_
#include "main.h"

int main(void) {

      uint8_t counter;

      while(1) {

            counter += INCREMENT_STEP;

      }

}

#endif // #ifndef MAIN_C_

 

<<<main.h>>>

#ifndef MAIN_H_

#define MAIN_H_

//global constant

#define GLOBAL 10

#ifdef MAIN_C_

//private constants

#define INCREMENT_STEP 2

#endif // #ifdef MAIN_C_

#endif // #ifndef MAIN_H_

 

This is a legit code which will get built successfully, but the s32 will report an error since its "live compiler" isn't aware that the MAIN_C_ will be defined when main.c includes main.h. I don't want to suppress all errors, and I don't like suppressing all "symbol could not be resolved" errors. I know I can use #pragma for inline error suppression, but that would make the code messy. Any alternatives?

Labels (1)
Tags (2)
1 Solution
2,160 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

which version of S32DS you use? for power or for ARM? I have tested the use case in S32DS for power version 1.1 with update 1 and it seems this error does not appear.

But there was a problem with parsing in previous version of S32DS.

Please write me back the version and in case you do not use the newest one, please install it.

Regards,

Martin

View solution in original post

4 Replies
2,160 Views
hrvojeerjavec
Contributor III

I haven't installed the latest update, I will now. Thank you for the prompt response.

0 Kudos
2,161 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

which version of S32DS you use? for power or for ARM? I have tested the use case in S32DS for power version 1.1 with update 1 and it seems this error does not appear.

But there was a problem with parsing in previous version of S32DS.

Please write me back the version and in case you do not use the newest one, please install it.

Regards,

Martin

2,160 Views
hrvojeerjavec
Contributor III

Oh sorry, the S32 version was S32 Design Studio for Power Architecture v1.1 without update. Now it is updated and working.

2,160 Views
hrvojeerjavec
Contributor III

Thank you Martin,

Updating the S32DS seems to have fixed the problem.

Kind regards,

Hrvoje

0 Kudos