Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1108931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:09:23+00:00 2026-05-17T02:09:23+00:00

So, I’ve been working for some time on connecting hashing out a trivial application,

  • 0

So, I’ve been working for some time on connecting hashing out a trivial application, comprising C++ and Objective-C, to prove some concepts and try and learn something.

Here’s where I’m at now, my command (being run, and re-run on changes) is

$ autoreconf -vis && make clean && ./configure && make && ./src/greetings

Note, that I’m hoping that it’ll run when I’m done, here’s a brief file list:

$ find . | ack '\.(?:cpp|mm|h)$'
./src/darwin/greet.cpp
./src/darwin/greeting.h
./src/darwin/greeting.mm
./src/greet.h
./src/main.cpp
./src/mingw32/greet.cpp
./src/mingw32/greet.h

The files in full, can all be found in this Gist at Github.

Rather than being a problem specifically with mixing the languages ( I don’t even make it that far) – I appear to stumble at the compiler not recognising that this is Objective-C (or ObjecC++) – for that reason, my autoconf files are in this gist.

With the complete error output here, also in a Gist.

Here’s a sample:

In file included from /usr/include/c++/4.2.1/iosfwd:48,
                 from /usr/include/c++/4.2.1/ios:43,
                 from /usr/include/c++/4.2.1/ostream:45,
                 from /usr/include/c++/4.2.1/iostream:45,
                 from darwin/greet.cpp:10:
/usr/include/c++/4.2.1/bits/stringfwd.h:48: error: template with C linkage
/usr/include/c++/4.2.1/bits/stringfwd.h:51: error: template with C linkage
/usr/include/c++/4.2.1/bits/stringfwd.h:54: error: template with C linkage
/usr/include/c++/4.2.1/bits/stringfwd.h:58: error: template specialization with C linkage
/usr/include/c++/4.2.1/bits/stringfwd.h:63: error: template specialization with C linkage
In file included from /usr/include/c++/4.2.1/iosfwd:49,
                 from /usr/include/c++/4.2.1/ios:43,
                 from /usr/include/c++/4.2.1/ostream:45,
                 from /usr/include/c++/4.2.1/iostream:45,
                 from darwin/greet.cpp:10:
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:09:24+00:00Added an answer on May 17, 2026 at 2:09 am

    From playing around with the zip file, here is what I recommend:

    Use a C-only interface on the language boundary. This will avoid automake’s non-existent Objective-C++ support. Use the

    #ifdef __cplusplus
    extern "C"
    #endif
    

    trick on your headers to ensure that the C++ compiler is going to generate C functions and the Objective-C compiler can handle the headers. This will make it possible for the Objective-C code to call your interface.

    Set up your source tree as you have before: common code in src/, OS-specific code in src/darwin, src/msdos (:P), src/win32 and so on. List all sources in EXTRA_foo_SOURCES in Makefile.am.

    In configure.ac, test which platform you are compiling for and use AM_CONDITIONAL to set flags that Makefile.am can read (you’ve done this correctly already).

    In Makefile.am, use the conditionals to include the correct additional sources:

    if OS_DARWIN
      foo_SOURCES += darwin/foo.m darwin/bar.h darwin/baz.m
      foo_LDFLAGS = -Wl,-framework,Foundation
    endif
    

    Note that because of how the linker is chosen, a C++ link will be attempted. Additional linker flags to make the Objective-C code link will need to be in foo_LDFLAGS.

    What had happened in your case was the following: In greet.h, you did not declare void greet(); as extern "C". This meant that when main.cpp was compiled, it expected a void greet() that had C++ linkage (in my case, the symbol was greet). darwin/greet.cpp was compiled and had void greet() declared as extern "C", so it produced a C version (with the symbol _greet). Linking then failed because the linker expected a greet symbol but nothing provided that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.