Godspped
Godspped

Reputation: 743

Problem with Vitis 2022.2 compile versus 2019.1 compiler when using a -D argument to pass a header file in

I am running into an issue when compiling code for the Microblaze where in any mb-gcc compiler (2021.1 or greater) seeing compliable code in 2019.1 mbb-gcc not work. It fails when trying to resolve a #include TEST_FILE where TEST_FILE is a macro being sent via the -D command in the makefile. See an example below:

C:/Xilinx/Vitis/2022.2/gnu/microblaze/nt/bin/mb-gcc -g -Wall -mlittle-endian -nostartfiles -pedantic -DTEST_FILE=\"test_file.h\" -I{LOCATION of the test file} -MM main.c

And then in the main.c I use:

#include TEST_FILE

In 2019.1 compiler I can compile just fine, but with 2022.2 I end up getting the following error:

error: #include expects "FILENAME" or <FILENAME>

Any ideas would be greatly appreciated.

Upvotes: 1

Views: 493

Answers (1)

Justin N
Justin N

Reputation: 911

It looks like another layer of shell expansion was added. You need a total of three backslashes in front of each quote to compensate for it:

C:/Xilinx/Vitis/2022.2/gnu/microblaze/nt/bin/mb-gcc -g -Wall -mlittle-endian -nostartfiles -pedantic -DTEST_FILE=\\\"test_file.h\\\" -I{LOCATION of the test file} -MM main.c

Upvotes: 0

Related Questions