I set up CDT for eclipse and wrote a simple hello world C program:
#include
int main(void){
puts(\"Hello, world.\");
return 0;
}
Also set ${COMMAND}
to gcc
on Linux
Under:
Replace:
${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"
with:
gcc -std=c99 -E -P -v -dD "${INPUTS}"
If you don't do this, the Eclipse stdout shows:
Unable to find full path for "-E"
and logs under ${HOME}/eclipse-workspace/.metadata/.log
show:
!ENTRY org.eclipse.cdt.core 4 0 2020-04-23 20:17:07.288
!MESSAGE Error: Cannot run program "-E": Unknown reason
because ${COMMAND} ${FLAGS}
are empty, and so Eclipse tries to execute the -E
that comes next.
I wonder if we can properly define the COMMAND
and FLAGS
variables on the settings, but I tried to add them as build variables and it didn't work.
C++ version of the question: How to solve "Unresolved inclusion:
Tested on Eclipse 2020-03 (4.15.0), Ubuntu 19.10, and this minimal Makefile project with existing sources.