Symbol could not be resolved, but build successful

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Symbol could not be resolved, but build successful

跳至解决方案
4,953 次查看
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?

标签 (1)
标记 (2)
1 解答
4,419 次查看
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

在原帖中查看解决方案

4 回复数
4,419 次查看
hrvojeerjavec
Contributor III

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

0 项奖励
回复
4,420 次查看
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

4,419 次查看
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.

4,419 次查看
hrvojeerjavec
Contributor III

Thank you Martin,

Updating the S32DS seems to have fixed the problem.

Kind regards,

Hrvoje

0 项奖励
回复