• 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
C file in Xcode C++ project -- Addendum
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C file in Xcode C++ project -- Addendum


  • Subject: C file in Xcode C++ project -- Addendum
  • From: Michael McLaughlin <email@hidden>
  • Date: Wed, 21 Nov 2007 13:33:41 -0500
  • Thread-topic: C file in Xcode C++ project -- Addendum

Should have added this to my previous posting (below).

I created a static C library (.a extension) from the Altivec code referenced
below and tried it out in an Xcode C project.  It worked perfectly.  Also,
the nm utility confirms that the necessary global symbols are exported.

However, adding this C library to the Xcode C++ app stationery, and calling
it, gives a linker error for undefined (static C library) symbols.

A library seems the way to go but the linker error has me stumped.  Judging
by the plethora of similar problems posted to this list, I would guess that
problems of this sort are common.  However, I could not find one to match
this case so I am hoping that someone out there can clue me in.

My previous posting related to an attempt to include the library source in a
C++ project directly -- not my first choice.

*** previous posting ***
I have a C source file, originally .c, which I want to include in a C++ app
project. It has the usual
extern "C" {
stuff.

I started with the Xcode C++ app stationery which builds and runs OK.

If I include the filename.c file as such in the project, I get 198 errors in
Apple C++ headers that I do not without it.  I get these errors even if
filename.c is totally empty!

If I change filename.c to filename.cp, then the original errors go away but
I get 55 new errors, beginning with an Altivec declaration

vector unsigned int s;

The error in this case is

ISO C++ forbids declaration of 'vector' with no type

The problem is not missing headers because filename.c is OK in a C project.
It looks like this initial ISO error spawned the rest.  Obviously, I am
missing some essential point.

Any tips?

--
Mike McLaughlin

 _______________________________________________
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

  • Prev by Date: C file in Xcode C++ project
  • Next by Date: Re: Xcode deployment
  • Previous by thread: Re: C file in Xcode C++ project
  • Next by thread: Re: C file in Xcode C++ project -- Addendum
  • Index(es):
    • Date
    • Thread