Eclipse CDT shows semantic errors, but compilation is ok

后端 未结 20 1451
青春惊慌失措
青春惊慌失措 2020-12-01 07:42

I have installed Eclipse Indigo for C/C++ Linux developers on Ubuntu 10.04 x86.

When I use common predefined macro __BASE_FILE__ Eclipse says Sym

20条回答
  •  醉话见心
    2020-12-01 08:17

    I used #pragma once in my code. This configuration caused me to have the problem:

    ---fileA.h---

    #pragma once
    #define MYMACRO(X) func(X)
    

    ---fileB.h---

    #include "fileA.h"
    

    ---fileB.cpp---

    #include "fileB.h"
    
    MYMACRO(5)  <---- warning here
    

    I replaced #pragma once with #ifndef #define HEADER_FILE_H #endif, and that fixed the problem.

提交回复
热议问题