• 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
undefined symbol (operator delete(void*)) can't be a weak definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

undefined symbol (operator delete(void*)) can't be a weak definition


  • Subject: undefined symbol (operator delete(void*)) can't be a weak definition
  • From: Curtis Laser <email@hidden>
  • Date: Fri, 24 Feb 2006 13:06:57 -0700

Problem summary:
How do I correct the error: "undefined symbol (operator delete (void*)) can't be a weak definition"?


Problem details:
I have two instances where I have some code I want to use in two places. An obvious case for building a library, and in this case a static library is preferred.


The first case is a unit test. My development language is objective-c+ +, and I am using cppunit. I would like to build the test files into a static library so they can be linked into two separate executables. One would just run my unit tests, the other would link to other unit tests for a much larger project and run them all. This works fine with a debug build using zerolink. But since the tests are declared as static variables in the test files, in release mode the statics in the library are never initialized since the library is never referenced. Consequently, no tests run. This is a pretty well documented problem.

The second case is similar, I am creating a NSView subclass (which I will refer to as customView) and a test application that will exercise the view as well as the final application that will host the view. So I bundle my custom view into a static library and link it into both the test application and the real application. When I run the release code, the log says that the nib file contains unknown class "customView", NSView was used instead. The debug code using zerolink works fine.

The situation is complicated by the fact that the library from case 2 is used to build the library in case 1.

The problems both appear to exist because no reference to the linked code exists so the linker strips it as an optimization step. To solve this problem I changed my target from a static library to an "object file", the notion being that linking an object file does not use the same optimization steps as linking with a static library. The object file builds fine, but whenever I try to link it in to another target I get the error mentioned above. BTW, the option "Link with standard libraries" is turned on for both the "Object File" and the executable.

Any ideas?
_______________________________________________
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: template with C linkage
  • Next by Date: (no subject)
  • Previous by thread: template with C linkage
  • Next by thread: Runs on PPC, crashes on Intel
  • Index(es):
    • Date
    • Thread