trying to compile keil project without using IDE and through just batch script

i am trying to compile keil project without using IDE and through just batch script and in that project c and c++ both files are there, i am using this command

armcc --cpp -c --cpu Cortex-M4.fp -g -O2 --apcs=interwork --split_sections -D__cplusplus -D__STRING_DECLS -I.\RTE\_dbg %CPP_INCLUDE_DIRS% -D__UVISION_VERSION=524 -D_RTE_ -DSTM32F479xx -o .\objects\test.o --list_dir .\\Listings\\ --list --omf_browse .\objects\test.crf --depend .\objects\test.d %SRC_PATH%\test.cpp

%CPP_INCLUDE_DIRS% -> group of include paths

%SRC_PATH%-> source path where all the cpp file are present.

test.cpp is a dummy cpp file, in that file when ever i am including header file include "string.h", it is showing this error "c:\Keil_v5\ARM\ARMCC\bin\..\include\string.CC(44): error: expected ';', near 'template'",

i have tried

-cpp11,

-cpp11 --cpp_compat

--cpp11 --strict

--cpp --gnu

--cpp --cpp_compat

test.cpp file

#include <stdio.h>
#include "string.h" //after adding this header file i am getting error c:\Keil_v5\ARM\ARMCC\bin\..\include\string.CC(44): error: expected ';', near 'template


extern "C" int cov_dumpData(void);

void UTExit (void)
{
return;
}

int main (void)
{
printf("\r\nhello\r\n");
if(1) {
int res = cov_dumpData();
if(0)
{
printf("\r\nCoverage Error \r\n");
}
UTExit();
return 1;
}
else
return 0;
}

can anyine help me, i just need to compile cpp files, though script , i am using keil MDK ARM 5.24.1, waiting for reply

  • Sorry, the information you provided is insufficient or wrong to be able to comment this. I can't see, that the standard include file of the Arm Compiler 5 includes "string.cc". So either you #include <string> instead. Or, #include "string.h" uses a custom file that you have in the source folder, which is full out of scope of the tool and fully your own.