• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mixing obective-C and c++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing obective-C and c++


  • Subject: Re: Mixing obective-C and c++
  • From: Scott Andrew <email@hidden>
  • Date: Mon, 9 Apr 2007 09:00:07 -0700

The compiler sees a .m file as an Objective-C file and can't call C++ routines from it and won't handle the manging properly. If it is a true C function (not a C++ function) wrap it with extern "C". If it is a true c++ function (returning a C++ class or is a cal into a C++ class) the rename your .m file to .mm which is for Objective C++.

On Apr 7, 2007, at 9:03 AM, Livio Isaia wrote:

Firstly, many thanks to everybody for helping.

So here is a new problem.
I have a ".c++" file with a procedure called from a ".m" file (Cocoa). But XCode tells me "undefined symbol" when linking (I turned off ZeroLink).


Let's say I have
   theCFile.h declaring theCProcedure,
   theCFile.c++ containing theCProcedure
   and theCocoaFile.m calling theCProcedure.

All files are in the same project; when building everything seems ok; I set "#include "theCFile.h"" in theCocoaFile.m; the target of theCFile.c++ is the target application...

I shouldn't be surprised if it couldn't link with some libraries called from theCFile.c++, but linking with theCFile.o?
Can you help some way?


Many thanks again,
regards, livio.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40adelphia.net


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Mixing obective-C and c++ (From: Livio Isaia <email@hidden>)

  • Prev by Date: Xcode problem before building
  • Next by Date: user-specific build variables?
  • Previous by thread: Re: Mixing obective-C and c++
  • Next by thread: Porting a Win static lib (.lib) to OS X
  • Index(es):
    • Date
    • Thread