Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Conditional compile not working(Use of #if/#elif shows on screen, does not compile)
Conditional compile not working [message #1851071] Sat, 26 March 2022 17:16
Andrew Coad is currently offline Andrew CoadFriend
Messages: 4
Registered: January 2022
Junior Member
This is driving me slowly mad. Again, Eclipse is showing me one thing on screen and compiling something different.
See attached files. The first one shows what I am seeing on screen - the preprocessor symbol BOARD_SWIFT is shown as active; BOARD_AMP_MODULE inactive.
The second file shows the preprocessor symbols at the project level. As expected, BOARD_SWIFT is set to 1, BOARD_AMP_MODULE is set to 0.

However, when I run the code, neither option is in effect. You can see where the breakpoint actually hit - the code skipped over all of the #if/#elif delimited code.

The only way that I can get this code to execute properly is to put the same preprocessor settings on the file itself. This file happens to be main.c so if I put BOARD_SWIFT=1 and BOARD_AMP_MODULE=0 on main.c, the code runs as shown on screen.

Why? Why does Eclipse suddenly decide that I have to put symbols at the file level? How do I prevent Eclipse from using file-level symbols?


Previous Topic:cuda not visible in new project or preferences even after installing cuda using add new software
Next Topic:Add a dependency on a specific file
Goto Forum:

Current Time: Tue Jan 31 11:46:29 GMT 2023

Powered by FUDForum. Page generated in 0.02297 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top