Symbol could not be resolved, but build successful

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Symbol could not be resolved, but build successful

ソリューションへジャンプ
4,796件の閲覧回数
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,262件の閲覧回数
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,262件の閲覧回数
hrvojeerjavec
Contributor III

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

0 件の賞賛
返信
4,263件の閲覧回数
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,262件の閲覧回数
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,262件の閲覧回数
hrvojeerjavec
Contributor III

Thank you Martin,

Updating the S32DS seems to have fixed the problem.

Kind regards,

Hrvoje

0 件の賞賛
返信