Fix and Continue fails on Carbon app
Fix and Continue fails on Carbon app
- Subject: Fix and Continue fails on Carbon app
- From: Scott Johnson <email@hidden>
- Date: Mon, 16 Apr 2007 12:57:44 -0700
I cannot get Fix and Continue to work on my Carbon application. I
usually get this error: "Error fixing [filename].c: NSLinkModule was
not able to correctly load the Fix bundle, most likely due to
unresolved external references."
If the file I am fixing includes ANY of the include files I have
created, and refers to functions declared in the included .h file but
defined in another .c file, then I get the above error. ZeroLink may
fix this problem (as I will show in my sample below), although I
cannot get my app to run with ZeroLink and would prefer to avoid
using it for now anyway. I am using C, not C++, and the documentation
only says ZeroLink is required for Fix and Continue if you are using C
++. In my experience below, it is USUALLY (though not always)
required for a Carbon app in C.
To reproduce my error in a simple test project:
1. Create a new Carbon Application (NOT C++)
2. Using the Debug build, turn OFF ZeroLink and make sure Fix and
Continue is on.
3. Build and Debug the app. Open main.c while the debugger is
running, click Fix. It should work fine. Terminate the debugger.
4. Create a new file in the project: New File->Carbon->C File. Call
it myinclude, and create both the .h and the .c files.
5. Open myinclude.h, add the line:
void mytest();
6. Open myinclude.c, add this code:
void mytest() {
return;
}
7. In main.c, add
#include "myinclude.h"
Additionally, add a call to mytest(); anywhere in any function in
main.c. I chose to put this call in WindowEventHandler under one of
the default cases, but it does not seem to matter where it goes (I
tried several locations, including the main function itself).
8. Save all the files. Build and Debug.
9. Open main.c, click Fix. You will get the error I mentioned above
EVEN IF YOU HAVE MADE NO CHANGES SINCE CLICKING BUILD AND DEBUG!
However, if you now delete mytest(); and click Fix, it will work (but
if you put it back and click Fix again, it will fail again).
Alternately, turn ZeroLink back on, Build and Debug, click fix with
the mytest(); call in main.c. It will work. Alternately, turn
ZeroLink back off, delete myinclude.c from the project, and change
the declaration of mytest() in the .h file to a full definition as
previously posted in myinclude.c before it was deleted. Now Build and
Debug, Fix, it works!
This says to me that ZeroLink is essentially necessary for Fix and
Continue to work in virtually any Carbon app written in C. That is,
unless you are using .h files that do not define their functions
in .c files (which you would almost never do, other than simple macros).
Is there something else that I am missing here or is there another
way around this problem? Thanks!
Scott
_______________________________________________
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