error: template with C linkage

This is a discussion on error: template with C linkage within the C++ Programming forums, part of the General Programming Boards category; Hi I am trying to build a project at the moment. However, I currently get a mass of "error template ...

  1. #1
    Registered User
    Join Date
    May 2006
    Location
    Berkshire, UK
    Posts
    29

    error: template with C linkage

    Hi

    I am trying to build a project at the moment. However, I currently get a mass of "error template with C linkage" errors. They appear to relate to the GNU ISO C++ library.

    The full list of messages is attached. Most of the problems seem to be with the standard libraries. This all compiled and linked perfectly a few days ago with the same include files (apart from <vector>, I think), although <map> was included.

    Foolishly I do not have an earlier version to revert to!

    Anyway, the fulll build output is as follows:

    Code:
    Building the whole Project: mrmCalcEngine ...
    make
    make  all-recursive
    make[1]: Entering directory `/home/miker/Projects/mrmCalcEngine'
    Making all in include
    make[2]: Entering directory `/home/miker/Projects/mrmCalcEngine/include'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/miker/Projects/mrmCalcEngine/include'
    Making all in src
    make[2]: Entering directory `/home/miker/Projects/mrmCalcEngine/src'
    if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include/mysql++ -I/home/miker/Projects/mrmCalcEngine/include -I/usr/local/mysql/include/mysql   -Wall -g -g -O2 -MT main.o -MD -MP -MF ".deps/main.Tpo" -c -o main.o main.cc; \
    then mv -f ".deps/main.Tpo" ".deps/main.Po"; else rm -f ".deps/main.Tpo"; exit 1; fi/usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:131: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:142: error: declaration of C function ‘const std::_Rb_tree_node_base* std::_Rb_tree_increment(const std::_Rb_tree_node_base*)’ conflicts with
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:139: error: previous declaration ‘std::_Rb_tree_node_base* std::_Rb_tree_increment(std::_Rb_tree_node_base*)’ here
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:148: error: declaration of C function ‘const std::_Rb_tree_node_base* std::_Rb_tree_decrement(const std::_Rb_tree_node_base*)’ conflicts with
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:145: error: previous declaration ‘std::_Rb_tree_node_base* std::_Rb_tree_decrement(std::_Rb_tree_node_base*)’ here
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:150: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:219: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:293: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:299: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:324: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:707: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:717: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:727: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:734: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:741: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:748: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:755: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:762: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:784: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:802: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:819: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:864: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:891: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:948: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1002: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1013: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1024: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1038: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1050: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1086: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1102: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1115: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1125: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1146: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1168: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1179: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1197: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1215: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1233: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1251: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1261: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_tree.h:1276: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:89: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:636: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:653: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:660: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:667: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:674: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:681: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_map.h:688: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:70: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:75: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:80: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:106: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:618: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:635: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:642: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:649: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:656: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:663: error: template with C linkage
    /usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/bits/stl_multimap.h:670: error: template with C linkage
    make[2]: *** [main.o] Error 1
    make[2]: Leaving directory `/home/miker/Projects/mrmCalcEngine/src'
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    make[1]: Leaving directory `/home/miker/Projects/mrmCalcEngine'
    Completed ... unsuccessful
    Total time taken: 1 secs
    Thanks,

    Michael.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,939
    Could it have something to do with extern "C" ?
    I am just speculating here, but maybe you used extern "C" around some template code, and since templates presumably require name mangling, the compiler/linker started complaining.

    Foolishly I do not have an earlier version to revert to!
    Tsk tsk, hope you have learnt your lesson and now use a proper revision control system.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2006
    Location
    Berkshire, UK
    Posts
    29
    Thanks laserlight - that was my initial thought but it does not appear to do anything... However, I have sorted the problem out by getting #include <map> out of my main.cc file... I really don't know why this should make any difference! Must be something to do with templates.

    As for version control, I did not really think of this as a new version, I had just added a few functions, without any changes of significance (so I thought), just a couple of added include files!

    Being in the middle of a serious bad hair day, this has thrown up another, very odd problem... which I have put in a new thread!

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,939
    As for version control, I did not really think of this as a new version, I had just added a few functions, without any changes of significance (so I thought), just a couple of added include files!
    That's why version control is also called revision control, since you dont have to consider new 'versions' when you use it.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linkage question
    By DL1 in forum C++ Programming
    Replies: 6
    Last Post: 01-13-2009, 06:56 PM
  2. internal/external linkage
    By MarkZWEERS in forum C++ Programming
    Replies: 1
    Last Post: 07-29-2008, 03:34 AM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  5. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21