Boost C++ Libraries: Ticket #346: Error: Template with C linkage https://svn.boost.org/trac10/ticket/346 <pre class="wiki">My email: valeika@email.unc.edu I'm a C++ noob, so thanks for looking this over. I am trying to use the boost graph library for an infection transmission project. However, I can't get the BGL to work. In even a simple program that just has: #include &lt;boost\graph\xxxx.hpp&gt; will not compile. I get hundreds of template with c linkage errors. I'm not sure where to go from here. I am using a Mac G5 and am using xcode to edit, build, compile and run my code. Xcode uses the gcc 3.3. Thanks, Steve </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/346 Trac 1.4.3 Jonathan Turkanis Tue, 25 Jan 2005 23:29:01 GMT <link>https://svn.boost.org/trac10/ticket/346#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/346#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=811799 There's no file named boost\graph\xxxx.hpp. Seriously, you need to say what file caused the error, and provide at least some of the error messages. Also, you should use forward slashes. Jonathan Turkanis </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>pulco-citron</dc:creator> <pubDate>Tue, 12 Apr 2005 09:13:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/346#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/346#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=625189 I'm having the same kind of errors, I think. I'm using a powerpc with darwin 7.8.0, compiling with gcc 3.3 (apple build) and gcc 3.4.3. Not a single boost source file compiles, in fact: every time a boost .hpp refers to some STL header, tons of "error: template with C linkage" come up. g++ mistakenly assumes that such included files have C linkage. IMHO, that can be corrected with the adequate compiler flag (which one ?) </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>stevehartwell</dc:creator> <pubDate>Wed, 13 Apr 2005 05:26:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/346#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/346#comment:3</guid> <description> <pre class="wiki">Logged In: YES user_id=962957 I have determined one way this problem can occur, and it's unrelated to boost. (I've googled and searched the boost archives but I haven't found a resolution for this problem yet). It seems that with gcc 3.3 (the MacOS X version I'm using), if any headers are found in the paths found by -isystem parameters, those header files will be compiled with C linkage, regardless of the source language being compiled (e.g. g++ or /usr/bin/gcc-3.3 -x c++ ...) Here's a transcript of a terminal session showing the problem: $ mkdir /tmp/sys $ ed a template &lt;class T&gt; inline void foo(T&amp; t) { } . w /tmp/sys/foo.hpp 45 q $ ed a /* */ #include "foo.hpp" int main(int argc, char **argv) { return 0; } . w foo.cpp 72 q $ cc -isystem /tmp/sys foo.cpp In file included from foo.cpp:2: /tmp/sys/foo.hpp:1: error: template with C linkage ~ $ g++ -isystem /tmp/sys foo.cpp In file included from foo.cpp:2: /tmp/sys/foo.hpp:1: error: template with C linkage $ </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>david_abrahams</dc:creator> <pubDate>Thu, 11 Jan 2007 00:39:48 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/346#comment:4 https://svn.boost.org/trac10/ticket/346#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> <pre class="wiki">Logged In: YES user_id=52572 Originator: NO Closing because the Graph developers use MacOSX and presumably it works for them. Feel free to reopen if this is inappropriate. </pre> Ticket anonymous Fri, 28 Sep 2007 03:44:53 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/346#comment:5 https://svn.boost.org/trac10/ticket/346#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">Works For Me</span> </li> </ul> <p> same problems. </p> <p> gcc-4.0 i686-apple-darwin8-g++-4.0.1 </p> <p> error: g++ -g -Wall -Wno-unused -I. -I/usr/include/libxml2 -I/usr/local/include -c main.cc -o main.o /usr/include/c++/4.0.0/bits/stl_relops.h:118: error: template with C linkage /usr/include/c++/4.0.0/bits/stl_relops.h:131: error: template with C linkage /usr/include/boost/checked_delete.hpp:29: error: template with C linkage </p> <p> I installed boost to prefix /usr, had to make a symbolic link ln -s boost-1_34_1 boost </p> Ticket Douglas Gregor Fri, 28 Sep 2007 11:30:43 GMT description changed; cc, severity set https://svn.boost.org/trac10/ticket/346#comment:6 https://svn.boost.org/trac10/ticket/346#comment:6 <ul> <li><strong>cc</strong> <span class="trac-author">valeika@…</span> added </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/346?action=diff&amp;version=6">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> <p> Which version Mac OS X are you using? </p> <p> Does a simple program including just &lt;vector&gt; compile? </p> <p> Steve Hartwell seems to have found the same problem on Mac OS X, and in his case it was unrelated to Boost. </p> Ticket Douglas Gregor Mon, 07 Jan 2008 03:55:24 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/346#comment:7 https://svn.boost.org/trac10/ticket/346#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> Without knowing if this problem is specific to the BGL or is a general C++ installation problem, there isn't anything we can do. Closing this ticket. </p> Ticket