Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Extension of source file (.c .cpp) affects how it is compiled??

HCL
Beginner
272 Views
Hello, New in using Intel C++ compiler here. I have an example C file listed below which illustrates the problem. There is no main function in the source by the way. ============================================ #include struct abc { int i,j; } ia; void f1(struct abc t) { printf("%d %d\n", t.i, t.j); } void uf3(void) { f1(ia); } ============================================ When the file is named as, for example, myfile.cpp,it compiles (cntrl+F7) fine. But when I called it myfile.c, then I have the following error >>>>> Error (active) argument of type "struct abc" is incompatible with parameter of type "struct abc" ..... ..... 12 >>>>> Line 12 is f1(ia); I am using Intel Parallel Studio XE Professional Edition for Fortran and C++ Windows 2016 together with Microsoft Visual Studio Community 2015. Any help would be much appreciated. Thank you very much. HCL
0 Kudos
2 Replies
Judith_W_Intel
Employee
272 Views

 

Yes. This matches the Microsoft (cl) compiler.

If you want to avoid this you can use these options:

/Tc<file>
          compile file as C source

/Tp<file>
          compile file as C++ source''

Judy

0 Kudos
HCL
Beginner
272 Views
Thanks Judy, didn't spot these 2 options!! HCL
0 Kudos
Reply