Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Rawlins__David
Beginner
35 Views

Code that compiled with Comper XE 2012 doesn't compile with 2013

Hi,

I'm attaching some code that compiled fine with Composer XE 2012, but is giving the following errors  with 2013 (Package ID: l_ccompxe_2013.5.192):

FEMultiphasic.cpp(30): error: incomplete type is not allowed
  void fn(complex<double>& z, complex<double>& fz, vector<double> a)
       ^

FEMultiphasic.cpp(30): error: identifier "complex" is undefined
  void fn(complex<double>& z, complex<double>& fz, vector<double> a)
          ^

FEMultiphasic.cpp(30): error: type name is not allowed
  void fn(complex<double>& z, complex<double>& fz, vector<double> a)
                  ^

FEMultiphasic.cpp(30): error: identifier "z" is undefined
  void fn(complex<double>& z, complex<double>& fz, vector<double> a)
                           ^

FEMultiphasic.cpp(30): error: expected a ")"
  void fn(complex<double>& z, complex<double>& fz, vector<double> a)
                            ^

FEMultiphasic.cpp(31): error: expected a ";"
  {
  ^

0 Kudos
11 Replies
JenniferJ
Moderator
35 Views

The compiler pkg id you posted is for Linux. I'm guessing that's a typo.

is the code compiled with VS2012 ok? The code can not be compiled because of the missing header files. if it uses many C++11 features, try adding /Qstd=c++11. It will turn on more C++ 11 support.

Also the coming 14.0 will support even more C++11 features.

Jennifer

Rawlins__David
Beginner
35 Views

Hi Jennifer,

We're compiling the code on multiple platforms.  Only linux is having problems.  In my makefile I'm including:

INTEL_INC = /opt/intel/composerxe/include/

If I delete that, it compiles without error.

Dave

SKost
Valued Contributor II
35 Views

>>...FEMultiphasic.cpp(30): error: identifier "complex" is undefined Please verify that a header file ( see a list below ) with declaration for complex type is included in case of compilation on a Linux platform. complex or complex.h or math.h or float.h
SKost
Valued Contributor II
35 Views

Please upload all the rest header files because your test case ( for Windows ) is Not complete.
JenniferJ
Moderator
35 Views

It might be just the env that is not setup.

did you source the compilervars.sh under the \opt\intel\composerxe\bin folder?

SKost
Valued Contributor II
35 Views

Here is a very simple reproducer ( source file attached ): [ Codes ] // Test036.cpp // http://software.intel.com/en-us/forums/topic/413944 #include "stdio.h" int main( void ) { complex< double > cd; return ( int )0; } [ Compilation Output ] ..\Tests>icl.exe /MD Test036.cpp Intel(R) C++ Compiler XE for applications running on IA-32, Version 12.1.7.371 Build 20120928 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. Test036.cpp Test036.cpp(8): error: identifier "complex" is undefined complex< double > cd; ^ Test036.cpp(8): error: type name is not allowed complex< double > cd; ^ Test036.cpp(8): error: identifier "cd" is undefined complex< double > cd; ^ compilation aborted for Test036.cpp (code 2)
Casey
Beginner
35 Views

Sergey Kostrov wrote:

Here is a very simple reproducer ( source file attached ):

[ Codes ]

// Test036.cpp
// http://software.intel.com/en-us/forums/topic/413944

#include "stdio.h"

int main( void )
{
complex< double > cd;

return ( int )0;
}

And here is a very simple fix

[cpp]

#include <stdio.h>
#include <complex>

int main( void )
{
std::complex< double > cd;

return ( int )0;
}

[/cpp]

Compiles with no errors or warnings with icpc (13.1.3 update 5), g++ (4.6.3)  and clang++ (3.3).

SKost
Valued Contributor II
35 Views

I did'n use #include "complex" statement in my example in order to reproduce the problem and in my previous post I already explained that some include headers are Not included in case of a Linux platform. Also, Dave provided a test case for Windows platform because it uses stdafx.h header file.
Anoop_M_Intel
Employee
35 Views

I isolated that function from your code base and created this code snippet:

[cpp]#include <stdio.h>
#include <complex>
#include <vector>
using namespace std;
void fn(complex<double>& z, complex<double>& fz, vector<double> a) {
        int n = (int)a.size()-1;
        fz = a[0];
        complex<double> x(1,0);
        for (int i=1; i<=n; ++i) {
                x *= z;
                fz += a*x;
        }
        return;
}
[/cpp]

$ icpc test.cc -c
$ icpc -V
Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.1.3.192 Build 20130607

The above command compiles the above file fine. Similarily, the same source compiles fine on Windows too. The command used on Windows is:

>icl test.cc -c

Thanks and Regards
Anoop

 

Sukruth_H_Intel
Employee
35 Views

Hi Dave,

           Since you conveyed that by setting the env var "INTEL_INC=" in the Makefile, You are able to reproduce the issue and as Sergey and Jennifer were able to reproduce the errors that you are getting by not including the "math/complex" header file, It hints us that setting this env var in Make file is misleading the "INCLUDE" path, which would be set when we source our compiler script "compilervars.sh <arch".

It would be helpful, if you can zip the project and upload here so we can edit the Makefile and test the issue.

What is the error/effect that you see if you don't include this env var in your Makefile?

Regards,

Sukruth H V

Rawlins__David
Beginner
35 Views

I concur that INTEL_INC in the Makefile is misleading the include path.  As far as I'm concerned the issue is resolved.

Thanks,

Dave