I tried to use a shortcut(alias) to point to a C header file but uVision2 couldn't resolve the shortcut when opening the project. So I have a shortcut with the name header.h that can point to header1.h, header2.h, and so on, but Uv2 can't figure out where header.h is pointing. Is there a solution to this beyond the obvious of multiple #includes, etc.?
#if defined HEADER_TO_USE #if HEADER_TO_USE == 2 #include "header_2.h" #elif HEADER_TO_USE == 3 #include "header_3.h" #else #error "Invalid value for HEADER_TO_USE #endif #else #error "HEADER_TO_USE is not defined" #endif
You Could define HEADER_TO_USE in a "configuration" header file, included before all others, on the command line, or via the Project options (eg, using different Targets).
Note the use of #else clauses to catch missing or invalid definitions;
Note also that it's best to avoid values 0 and 1 - as these are often used as defaults when a symbol is defined (especially on the command line) without assigning a specific value...