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

Error with _Complex datatype

Milind_Kulkarni__Int
New Contributor II
606 Views
I am encounteringsome problems with _Complex datatype

Also, the programs that use _Complex in the compiler doc have been mentioned in the doc to work, but I could not get them working.

Following is a small test-case for the same:--

[bash]#include 
#include 
int main()
{  
float _Complex C;
return 1;
}[/bash]

This small piece of code does not work (I have only checked with Windows* as of now with 11.1 compiler)..

I am using flag /Qstd=c99 , but am getting error that does not make much sense.

C:\\Documents and Settings\\mkulka3\\My Documents\\Intel-Docs\\KBstuff\\462642>icl /Qs

td=c99 comp3.cpp

Intel C++ Compiler for applications running on IA-32, Version 11.1 Build 2

0090421 Package ID: composer.061

Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

comp3.cpp

C:\\Program Files\\Intel\\Parallel Studio\\Composer\\Include\\complex.h(30): warning #

1224: #warning directive: "The /Qstd=c99 compilation option is required to enabl

e C99 support for C programs"

# warning "The /Qstd=c99 compilation option is required to enable C99 support

for C programs"

^

comp3.cpp(5): error: expected a ";"

float _Complex C;

^

compilation aborted for comp3.cpp (code 2)

-------------------------------------------------------------

0 Kudos
3 Replies
Milind_Kulkarni__Int
New Contributor II
606 Views

Oh I did a small mistake. Renaming .cpp to .c file compiles correctly, as its allowed only for C language. Not for C++ language, as specifically mentioned in the compiler doc.

Any specific reason that we do not allow _Complex in C++ . Its just like any other datatype, and should work in C++ also, or is it according to standard specification?

Because the same C++ (with .cpp extension) program works in Linux* compiler, so why not in Windows* compilers.

0 Kudos
Judith_W_Intel
Employee
606 Views

_Complex ispart ofthe C99 language standard, not the C++ standard. C++ users are expected to use the templatized complex types available in the C++ standard library, i.e.

#include

int main() {
std::complex C;
return 0;
}

0 Kudos
Fowler__Austin
Beginner
606 Views

Has anyone got double _Complex working in Visual Studio? I have an existing C project that uses this but have not been able to configure VS with icl such that is compiles, despite being able to compile using icl from the command line.

0 Kudos
Reply