Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7779 Discussions

"inline namespace" cannot be compiled with Intel C++ compiler 16 or 17

Bin_C_
Beginner
579 Views

I'm using Intel C++ compiler 16 with Visual Studio 2015 (platform toolset v140), which has inline namespace literals {} defined in string file. Intel C++ compiler 16 cannot compile it. I tried Intel C++ compiler 17 too. no luck.

If I set platform toolset to v120, which is Visual Studio 2013's toolset and doesn't have inline namespaces defined, Intel C++ compiler 16 and 17 can compile it.

Can anybody advise how to fix or workaround it? I need VS 2015 to work with Intel compiler for other features.

Thanks,

0 Kudos
10 Replies
Judith_W_Intel
Employee
579 Views

 

What is the command line you are using? It doesn't have the /Qvc option in it, does it?

What is the version of cl that is in your PATH? Do a "which cl".

Does adding the option /Qvc14 help? Note that this should not be needed if the MSVC++ 2015 compiler is in your PATH...

thanks

Judy

 

 

Bin_C_
Beginner
579 Views

The command line (copy/paste from "property page" of VS 2015) is

/GS /TP /W3 /Zc:wchar_t /I"..\pthreads\include" /I"..\pa" /I"..\d264enc" /I"..\vectors" /Zi /Od /Fd"C:\Projects\c265_s265_ref\build\Debug\x64\libD264enc.pdb" /D "WIN32" /D "WIN64" /D "_CRT_SECURE_NO_WARNINGS" /D "__X86__" /D "_WIN32" /D "_MBCS" /Qstd=c++11 /Zc:forScope /RTC1 /arch:AVX /MDd /Fa"Debug\x64\libD264enc\" /EHsc /Fo"Debug\x64\libD264enc\" /Qprof-dir "Debug\x64\libD264enc\" /Qstd=c99 /Fp"Debug\x64\libD264enc\libD264enc.pch"

and Additional options:

/Qstd=c++14 /arch:CORE-AVX2

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86>where cl
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64_x86\cl.exe

Note that I used inter compiler so icl.exe actually was building the code and failed with inline namespaces.

Judith_W_Intel
Employee
579 Views

 

Hmmm nothing looks suspicious there...

Can you do a "icl -V"? That will show the version and date of the compiler.

If you try this small example from the command line does it work?

!% cat t.cpp

namespace std {
inline namespace literals {}
}
!%
!% icl -c t.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Versi
on Mainline Beta Build x
Built Nov 11 2016 17:52:59 by jward4 on JWARD4-DESK1 in D:/workspaces/cfe/dev
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

t.cpp
!%

Also does explicitly adding /Qvc14 to the command line fix the problem?

 

 

 

Bin_C_
Beginner
579 Views
I have left office but I will try tomorrow and post the results.
Bin_C_
Beginner
579 Views

I tried the two additional arguments (-V and Qvc14). Enclosed below are the outputs of icl.exe. Also, when I compiled the file individually using the command line (icl.exe -c string.cpp. note that in order to run icl.exe in cmd, I had to run "compilervars.bat -arch intel64 vs2015" first), it worked! This file (string) was from MS VS 2015 and not supposed to be modified. I attached this file for your reference. In order to compile it using icl.exe, I had to change its name to "string.cpp" from "string". So the question is why icl.exe cannot compile the file "string" when it's used in a VS project? It shouldn't because it doesn't have a file ext, right? (a file without extension isn't allowed to upload so I had to change it to string.cpp)

This is the complete command line to build the file individually:

C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.4.246\windows\bin\intel64>icl.exe -c string.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.4.246 Build 20160811
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

string.cpp

I got string.obj after running the above command line.

=======================   below is the output of icl.exe when used in VS 2015 ===============================

1>------ Build started: Project: libD264enc, Configuration: Debug x64 ------
1>  icl /Qm64 /I..\pthreads\include /I..\pa /I..\d264enc /I..\vectors /Zi /W3 /Od -D __INTEL_COMPILER=1600 -D WIN32 -D WIN64 -D _CRT_SECURE_NO_WARNINGS -D __X86__ -D _WIN32 -D _MBCS /EHsc /RTC1 /MDd /GS /arch:AVX /Zc:wchar_t /Zc:forScope /Qstd=c99 /Qstd=c++11 /FoDebug\x64\libD264enc\ /FdC:\Projects\c265_s265_ref\build\Debug\x64\libD264enc.pdb /TP /Qstd=c++14 /arch:CORE-AVX2 /Qvc14 -V ..\d264enc\prediction.c ..\d264enc\bdr.c ..\d264enc\x86\x86_interpolate.c
1>
1>  Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20160811
1>  Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.
1>icl: : warning #10121: overriding '/Qstd=c99' with '/Qstd=c++11'
1>icl: : warning #10121: overriding '/Qstd=c++11' with '/Qstd=c++14'
1>icl: : warning #10121: overriding '/archAVX' with '/archCORE-AVX2'
1>
1>
1>  prediction.c
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\string(671): error : expected an identifier
1>    inline namespace literals {
1>           ^
1>
1>  Error: inline specifier allowed on function declarations only
1>
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\string(672): error : expected an expression
1>    inline namespace string_literals {
1>    ^
1>
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\string(699): error : expected a ";"
1>    _STD_END
1>    ^

Bin_C_
Beginner
579 Views

on a second thought, I think you can create a .cpp file that include the file "string" to see if it works for you.
 

Judith_W_Intel
Employee
579 Views

 

I think I understand the problem now. The suffix on your file is .c -- i.e. the name of the file is "x86_interpolate.c" so icl is being run in C (not C++) mode.

To fix this, either change the name of the file to have a suffix like .cpp or .cxx or use the /Tp or /TP option. The <string> header file is a C++ header file so it will only compile if you compiling C++.

/Tc<file>
          compile file as C source

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

/TC       compile all source or unrecognized file types as C source files

/TP       compile all source or unrecognized file types as C++ source files

 

Bin_C_
Beginner
579 Views

Hi Judith,

Thanks for the continued help. If you look at the command line I posted on #3 post, it already included /TP. I double checked just now. /TP has been there but it still failed......  Just now, I tried the following commands again but with the file "string" (no ext).

1. When I ran "icl.exe -c string", it refused to compile.

2 When I ran "icl.exe -c string /TP", it compiled.

So the standalong command always works but failed to compile the "inline namespace" with VS 2015. I'm using VS 2015 community version, which is free. If you try it by building a project using its file "string", you may see it too.

 

Judith_W_Intel
Employee
579 Views

 

Yes you are right you are already using /TP. So it seems the problem only occurs inside the Visual Studio environment and not on the command line. Hmmm...

I don't have access to a Visual Studio setup but I'm guessing it's using a different (older?) icl compiler than the one on the command line. Do you have multiple Intel compiler installations on your desktop? I'm not sure what else could be going wrong...

Bin_C_
Beginner
579 Views

I have only one Intel Compiler installed. Also, if you look at the above output of Intel Compiler with -V, you will see the following output along with the compile failure messages

1>  Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20160811

I guess your QA teams must have tested it with VS 2015 so it can't be a bug, right? If possible, can you bring this to their attention? They should have an access to VS 2015 since that's one of features supported. This also happened to Instell Parallel XE 2017. I tried 2017 first and then 2016.

Thanks again for working on my questions!

 

Reply