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

Undefined symbols for architecture x86_64: __ZTVNSt3__123__match_any_but_newlineIcEE

pascal_M_
Beginner
603 Views

I have the following c++ code :

 #include <iostream>
 #include <regex>
 #include <string>

  using namespace std;

  int main()
 {
   string input;
   regex rr("((\\+|-)?[[:digit:]]+)(\\.(([[:digit:]]+)?))?((e|E)((\\+|-)?)[[:digit:]]+)?");
   //As long as the input is correct ask for another number
   while(true)
   {
     cout<<"Give me a real number!"<<endl;
     cin>>input;
     if(!cin) break;
     //Exit when the user inputs q
     if(input=="q")
       break;
     if(regex_match(input,rr))
       cout<<"float"<<endl;
     else
     {
       cout<<"Invalid input"<<endl;
     }
   }
 }

that I compile as follow (m_ccompxe_2013_sp1.4.201) :

/opt/intel/bin/icpc -std=c++11 tst_regex.cpp -o tst_regex

Which throws me the following :

Undefined symbols for architecture x86_64:
  "__ZTVNSt3__123__match_any_but_newlineIcEE", referenced from:
      __ZNSt3__111basic_regexIcNS_12regex_traitsIcEEE12__parse_atomIPKcEET_S7_S7_ in icpc01Hn6D.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64

Any idea ?

0 Kudos
4 Replies
Shenghong_G_Intel
603 Views

I cannot reproduce this with 2013 and 2016 both, on Linux.

$ source /opt/intel/composer_xe_2013_sp1.4.211/bin/compilervars.sh intel64
$ icpc temp.cpp -std=c++11
$ source /opt/intel/composer_xe_2013_sp1.4.211/bin/compilervars.sh ia32
$ icpc temp.cpp -std=c++11
$ source /opt/intel/compilers_and_libraries_2016.0.109/linux/bin/compilervars.sh intel64
$ icpc temp.cpp -std=c++11
$ ./a.out
terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error
Aborted (core dumped)
$

What is the version for "m_ccompxe_2013_sp1.4.201"?? "m" means Mac OS, right? Please confirm if you are using Mac or Linux. And if possible, please upgrade to v16.0 to try, 2013 version is too old and will not have any bug fix.

Thanks,

Shenghong

0 Kudos
pascal_M_
Beginner
603 Views

Thanks for your answer : I am using Mac. I updated to v 15.0.3 and don't have the issue anymore. Out of curiosity, on your linux, what does the command

/opt/intel/bin/icpc -v

give ?

Apparently, my issue has to do with the fact that my compiler version is too old "with respect to c++11 features", right ? As you do not reproduce on your linux with 2013, it means that Linux's 2013 intel compiler was ahead of Mac's 2013 Intel compiler "with respect to c++11 features". Am I right ?

Last question : now in /opt/intl i have this :

drwxr-xr-x  19 root  wheel  646 Sep 14 22:47 bin
drwxr-xr-x  13 root  wheel  442 Aug 31 22:07 composer_xe_2013_sp1
drwxr-xr-x  18 root  wheel  612 Aug 31 22:07 composer_xe_2013_sp1.4.201
drwxr-xr-x  13 root  wheel  442 Sep 14 22:47 composer_xe_2015
drwxr-xr-x  15 root  wheel  510 Sep 14 22:47 composer_xe_2015.3.187
lrwxr-xr-x   1 root  wheel   18 Sep 14 22:47 composerxe -> ./composer_xe_2015
lrwxr-xr-x   1 root  wheel   20 Sep 14 22:47 include -> ./composerxe/include
lrwxr-xr-x   1 root  wheel   16 Sep 14 22:47 ipp -> ./composerxe/ipp
drwxr-xr-x   3 root  wheel  102 Aug 31 21:19 ism
lrwxr-xr-x   1 root  wheel   16 Sep 14 22:47 lib -> ./composerxe/lib
lrwxr-xr-x   1 root  wheel   16 Sep 14 22:47 man -> ./composerxe/man
lrwxr-xr-x   1 root  wheel   16 Sep 14 22:47 mkl -> ./composerxe/mkl
lrwxr-xr-x   1 root  wheel   16 Sep 14 22:47 tbb -> ./composerxe/tbb

How could I do to use the former (2013) compiler, or to switch between both compiler easily ?

0 Kudos
Shenghong_G_Intel
603 Views

Q#1:

$ source /opt/intel/composer_xe_2013_sp1.4.211/bin/compilervars.sh intel64
$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.4.211 Build 20140805
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

$

Q#2:

Apparently, my issue has to do with the fact that my compiler version is too old "with respect to c++11 features", right ? As you do not reproduce on your linux with 2013, it means that Linux's 2013 intel compiler was ahead of Mac's 2013 Intel compiler "with respect to c++11 features". Am I right ?

>> Yes, it seems very like to be related to the issue of C++11. But C++11 has 2 parts mainly, one is syntax part (extensions of syntax for example), and one is library part (new library, C++11 thread for example, and C++11 regex in your case). Intel compiler should support C++11 for different platforms at the same levels, but for library part, we do not have our own implementation of C++ standard library and we depends on the libraries provided by GNU (on windows, it is MS libraries). If you are using GCC, it may be related to GCC version (On my Linux, I am using 4.8.1) and its C++11 headers/libraries.

Summary: we cannot get conclusion that Linux's 2013 intel compiler was ahead of Mac's 2013 intel compiler with respect to C++11 features. :)

Q#3:

How could I do to use the former (2013) compiler, or to switch between both compiler easily ?

>> The suggested way to switch between compilers is to use our "source" script, as below:

$ source /opt/intel/composer_xe_2013_sp1.4.211/bin/compilervars.sh intel64
$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.4.211 Build 20140805
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

$ source /opt/intel/composer_xe_2015.3.187/bin/compilervars.sh intel64
$ icc -V
Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.187 Build 20150407
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.

$

Hope it is clear. Let me know your concerns.

Thanks,

Shenghong

0 Kudos
pascal_M_
Beginner
603 Views

Thanks a lot for your thorough answers. No more concerns anymore ;-)

P.

0 Kudos
Reply