This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Greetings,
Our projects are written in C++, and we use the “Treat C files as C++ files (--cpp_default, -fg)” Language mode. Now we are trying to add a cla file to the project. This causes the complier to try to build the CLA file as a cpp file and fails with:
C++ source files are not allowed for CLA
If the "Treat C files as C++ files (-cpp_default, -fg)" box is unchecked, it still fails with:
#35 #error directive: "Header file <stdlib.h> not supported by CLA compiler" .ccsproject /<project_name> line 47, external location: C:\ti\ccs1250\ccs\tools\compiler\ti-cgt-c2000_22.6.1.LTS\include\stdlib.h C/C++ Problem
But the CLA file does not use stdlib.h, and I can’t find any option which would auto-include it.
Is there an option which would force the cla files to be treated as C files?
Thank you,
Ed
Hi Ed,
Files with a .cla extension are compiled as C files with a special invocation of the compiler for CLA.
It looks like the issue you're running into is that the --cla_support flag is being evaluated by the compiler before the --cpp_default, so the .cla file is already being considered a C file when --cpp_default is evaluated.
You can try following the steps in the 2.4.1 Setting Default Compiler Options (C2000_C_OPTION) section of the C28x compiler guide (linked here) to define your own compiler flags and move the --cla_support flag after --cpp_default flag.
Best Regards,
Delaney
Hi Delaney,
This could swap the processing of the two flags. But would all the other flags need to be in C2000_C_OPTION too? In other words, when C2000_C_OPTION is used, does the compiler start with a set of defaults, or does it take the values already in the project Properties and modify those?
Thank you,
Ed
Hi Ed,
That is a good question, let me loop in one of the compiler experts to comment.
Best Regards,
Delaney
Is there an option which would force the cla files to be treated as C files?
No. But there is a way to resolve the problem.
Use the File Specific Options feature of CCS on the CLA file. Use it to remove the option --cpp_default for the CLA file.
Thanks and regards,
-George
Hi George,
For the cla file, I unchecked the Language Option “Treat C files as C++ files (--cpp_defult, -fg)” and that replaced the “C++ source files are not allowed for CLA” error with “#35 #error directive “Header file <stdlib.h> not supported by CLA compiler”. I have looked through the compiler options, but can’t find anything which tells it to not use stdlib.h, Did I miss something?
Thank you,
Ed
It must be the case that the CLA file somehow includes stdlib.h. Just as a build time experiment, add the option --gen_preprocessor_listing. To learn what that option does, please search for it in the C28x compiler manual. Among other things, it creates a file with same name as the source file, but the file extension is changed to .rl. Use the .rl file to work out how stdlib.h is included.
Thanks and regards,
-George
I had the same thought. So I deleted everything in the .cla file to make it 0 length. The problem still persists. In both cases, the first two lines of the rl file are:
L 1 "<path to the .cla file>/<file_name.cla>"
L 1 "C:/ti/ccs1250/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS/include/stdlib.h" 1
So I feel as though there must be another setting which I am not aware of which is automatically including stdlib.h.
Thank you,
Ed
Hi George,
I found it! In the Include Options, there was a preinclude file of stdlib.h. I removed it for the cla file, and now it builds! Thank you for showing me how to change the properties of a single file. That gave me the tool I needed to make it work.
Thanks again,
Ed