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

no std::complex<double> with icpc 13.0.1

Walter_D_
Beginner
1,428 Views

icpc 13.0 had trouble with compiling gcc 4.7.0 header "complex" when using "-std=c++0x" (see http://software.intel.com/en-us/forums/topic/326830), so we installed icpc (ICC) 13.0.1 20121010. However, the following simple code attached fails to compile (regardless of whether I use -std=c++0x or not) with the error message

test.cc(5): error: namespace "std" has no member "complex"

Is there any workaround or cannot I simple not use std::complex<> with Intel?
 

0 Kudos
7 Replies
Judith_W_Intel
Employee
1,428 Views
This works fine for me with or the without -std=c++0x option. Can you preprocess the file (use the -E option) and attach the resultant test.i file? In other words do: icpc -c -E test.cpp >test.i this should result in a test.i file which shows what files are being included. thanks Judy
0 Kudos
Walter_D_
Beginner
1,428 Views
uploaded test.i generated by icpc -c -E test.cpp >test.i
0 Kudos
Judith_W_Intel
Employee
1,428 Views
Looks like the first header file that's being found is in /cm/shared/apps/ics/include/complex. That then includes a file in /cm/shared/apps/ics/composer_xe_2013.1.117/compiler/include/complex. None of these actually have any code after preprocessing in them. What does the header file /cm/shared/ics/include/complex look like? Is it an Intel supplied header? I think your search path is wrong and that the first header that should get included is /cm/shared/apps/ics/composer_xe_2013.1.117/compiler/include/complex. Judy
0 Kudos
Walter_D_
Beginner
1,428 Views
/cm/shared/apps/ics/composer_xe_2013.1.117/compiler/include/complex and /cm/shared/apps/ics/include/complex are identical (verified by diff; see uploaded -- extension .h added to allow upload). what does #include_next do?
0 Kudos
Judith_W_Intel
Employee
1,428 Views
#include_next looks for an include file with the same name (in this case ) on the next directory after the current one in the search path. So if your search path looks like -Iincludedir1 -Iincludedir2 ant includedir1/complex has an #include_next in it will include the complex header from includedir2. So what should be happening in the Intel version of should do some stuff and then include the GNU version. Anyway I don't understand why you have two identical directories and why they are both being specified in your search path. The icpc driver should only be including the Intel substitute header directory that was actually installed with the most recent version of the compiler. Does /cm/shared/apps/ics/include contain headers from some old installation? Or did someone manually copy all the headers there?
0 Kudos
bernaske
New Contributor I
1,428 Views
Hi Walter, i have Your sample compiled with the Intel C/C++ Parallel Studio XE 2013 ( update 1 ) under openSUSE 12.2 Linux no problems only following warning -rw-r----- 1 root root 6722 Nov 17 18:29 complex.h -rw-r----- 1 root root 117 Nov 16 14:43 test.cpp linux-cuda:/local/test # icpc -std=c++0 test.cpp icpc: command line warning #10159: invalid argument for option '-std' linux-cuda:/local/test # ls -l total 32 -rwxr-xr-x 1 root root 16873 Nov 18 05:56 a.out -rw-r----- 1 root root 6722 Nov 17 18:29 complex.h -rw-r----- 1 root root 117 Nov 16 14:43 test.cpp linux-cuda:/local/test # ./a.out Z=(1.2,2.3) or recompile as follow: linux-cuda:/local/test # ls -l total 12 -rw-r----- 1 root root 6722 Nov 17 18:29 complex.h -rw-r----- 1 root root 117 Nov 16 14:43 test.cpp linux-cuda:/local/test # icpc -std=c++0 test.cpp icpc: command line warning #10159: invalid argument for option '-std' linux-cuda:/local/test # ls -l total 32 -rwxr-xr-x 1 root root 16873 Nov 18 05:56 a.out -rw-r----- 1 root root 6722 Nov 17 18:29 complex.h -rw-r----- 1 root root 117 Nov 16 14:43 test.cpp linux-cuda:/local/test # ./a.out Z=(1.2,2.3) linux-cuda:/local/test # icpc -std=c++0x test.cpp linux-cuda:/local/test # ./a.out Z=(1.2,2.3) linux-cuda:/local/test # linux-cuda:/local/test # okay under linux no problems regards Franz
0 Kudos
Walter_D_
Beginner
1,428 Views
Franz, you didn't use c++11 (by misspelling the option "-std=c++0x" as "-std=c++0", creating the warning), hence your test is irrelevant. The problem has been resolved by now. Our system admin, who installed the compiler using the standard Intel installer (only changed the install directory from the default, but nothing else), unnecessarily added the the Intel include paths to the environment variables CPLUS_INCLUDE_PATH, so that #include_next included the same file again (like me, he wasn't aware of the #include_next directive). thanks for you help!
0 Kudos
Reply