Just installed Intel's oneAPI and it's compiler dpcpp.exe.
Trying it to compile a C-project of mine seems impossible w/o a major rewrite.
Seems to me it only supports C++ even when using "dpcpp -TC ...". Rather disappointing.
Many warnings on stuff like "char *p = malloc (len);" causing
error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'
So what's the option "-TC" really for?
Edit: Switching to icx.exe did the trick.
連結已複製
Hi,
Thank you for posting in Intel Communities.
>> So what's the option "-TC" really for?
This option tells the compiler to process all source or unrecognized file types as C source files.
For more information, please refer to the link mentioned below.
Could you please provide us with a sample reproducer along with the compiler version being used so that we can investigate your issue from our end.
Thanks and Regards,
Ditipriya.
> Could you please provide us with a sample reproducer along with the compiler version being used so that we can investigate your issue from our end.
Here is a simple example GNU-makefile (called dpcpp-test.mak) or attached:
------------- 8< --- 8< -----------
CFLAGS = -MD -TC
all: dpcpp-test.exe
dpcpp-test.exe: dpcpp-test.obj
xilink -out:dpcpp-test.exe $<
dpcpp-test.obj: dpcpp-test.c
dpcpp $(CFLAGS) -Fo$@ $<
dpcpp-test.c: dpcpp-test.mak
$(info Generating $@)
$(file > $@,$(dpcpp-test_C))
define dpcpp-test_C
//
// Generated file. DO NOT EDIT!
//
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
char *p = malloc(1000);
printf ("p: 0x%p\n", p);
p ? free(p) : ((void)0);
return (0);
}
endef
------------- 8< --- 8< -----------
Issuing make -f dpcpp-test.mak, gives:
Generating dpcpp-test.c
dpcpp -MD -TC -Fodpcpp-test.obj dpcpp-test.c
dpcpp-test.c(8,11): error: cannot initialize a variable of type 'char *' with an rvalue of type 'void *'
char *p = malloc(1000);
^ ~~~~~~~~~~~~
1 error generated.
Enough said.
Hi,
DPC++ will support only c++ code from c++ 17 and onwards. Hence -TC option does not work.
It is working with icx and icx in windows works for both c as well as c++ code. So, it is behaving correctly.
Thanks and Regards,
Ditipriya.