Hi, I'm compiling with icl some code that has previously been compiled with gcc. I'm getting errors because icl doesn't like declarations appearing after executable statements in a function. I can fix these errors by moving the declarations to the top of the functions, but I'm wondering is there is a compiler option that would take care of it. The source files have '.c' extension, and I'd rather not change that.
As long as you follow C language syntax, icc should compile without issue. The icc works for me.
$ cat hello.c
int x, y, z;
x = 5;
y = 10;
z = x+y;
fx = 3.0* x;
printf("x = %d, y = %d, z = %d, fx = %f\n", x, y, z, fx);
$ icc hello.c
x = 5, y = 10, z = 15, fx = 15.000000
$ icc -V
Intel C Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20100128 Package ID: l_cproc_p_11.1.066
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
$ uname -a
Linux dpd22 2.6.18-52.el5 #1 SMP Wed Sep 26 15:26:44 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
I can use /Qstd=c99 when compiling with icl, but because of the makefile problems I've encountered (see my other thread) I am now trying to build this application using MS Visual Studio. I've tried adding the following to Configuration Properties > C/C++ > Command line > Additional options:
but none works.
Since the help docs say of Qstd that
Windows: Language > Enable C++0x Support
I looked for such an option in the project properties, but didn't find it.
Is there a way to get the effect of /Qstd=c99 in MSVS?
When using MSVS, it seems you forgot to change to Intel compiler. so its using cl compiler, for which /Qstd=c99 does not work. To change the compiler, right-click Project in the Solution Explorer Window, and > Parallel Composer> Use Intel C++. Then the option will work.
If you want to work with MS compiler, then go to Properties>C/C++>Advanced>Compile As , and set as C++ code (/TP) option, and it will work, for icl as welll as cl. Hope it works in your case too.
I was just about to say "Do you think I'm stupid?" then I checked and found that I am! I didn't even realize that I had MSVC installed - this is my first foray into C for a few years.