objc_startCollectorThread() implicit declaration warning - objective-c

I'm trying to work through Apple's CoreData Utility Tutorial. It asks me to create a 'Foundation Tool' project in the 'Command Line Utility' section. In XCode 3.2, I only found a 'Command Line Tool' section with a 'Foundation' type in the 'New Project' wizard.
So I created the 'Command Line Tool' 'Foundation' type project, and added the following line to enable garbage collection:
objc_startCollectorThread();
I also changed the 'Objective-C Garbage Collection' setting in my 'Target Info' 'Build' tab to 'Required [-fobjc-gc-only]'. When I run my build, I get the following error:
warning: implicit declaration of function 'objc_startCollectorThread'
The target runs fine so far. All it does is print 'Hello World' to the console. I'm just concerned about this warning. I must be doing something wrong if I'm getting warnings for something as basic as garbage collection on a command line tool.

You should #include <objc/objc-auto.h>, which is where this function is defined.

Related

VBNC compile errors

I've just installed mono complete, mono-vb and associated libraries, it all appears to be there.
I've written the simplest of vb examples:
print "Hello, this is a test"
end
but vbnc gives me an error "Expected identifier" for each line. I've tested with more lines of code and I get an error for each line in my file.
What am I missing?

how to automatically break the lua program at the error line

I use my own interpreter to run the lua program and debug with zerobrane. If the interpreter encounters an error, how to let the debugger break at the error line?
There is no mechanism in Lua that allows to catch run-time errors. There was a call to debug.traceback function in Lua 5.1, but it's no longer called in Lua 5.2+. If you have your own error handling, you can call require("mobdebug").pause(), which will request ZeroBrane Studio debugger to stop on the next executable Lua line, which will allow you at least to see the stack trace and the location of the error, but this is probably all you can do. You can also try to assign debug.traceback to the function that calls pause, but, again, this will only work in Lua 5.1.
For example, try running the following script from the IDE:
require("mobdebug").start()
debug.traceback = function(...)
print("traceback", ...)
require("mobdebug").pause()
end
a()
print("done") -- it will never get here
If you save it into on-error.lua file and run, you should see the execution stopped on line 5 (after the pause()) call with the following message:
traceback on-error.lua:6: attempt to call global 'a' (a nil value) 2

literal string expected error

Please have a look at the following code
with text_io;
use text_io;
procedure hello is
begin
put_line("hello");
new_line(3);
end hello;
When I click "build all" in GPS IDE, I get this error
gnatmake -d -PC:\Users\yohan\firstprogram.gpr
firstprogram.gpr:1:06: literal string expected
firstprogram.gpr:2:01: "end" expected
gnatmake: "C:\Users\yohan\firstprogram.gpr" processing failed
[2013-04-03 13:29:58] process exited with status 4 (elapsed time: 00.47s)
I am very new to Ada, as you can see, this is my first program. Please help.
On the command line, gnatmake will happily compile a file which contains Ada code but has the extension .gpr. GPS knows "better" than that, and insists on treating myfirstprogram.gpr as a GNAT Project file, which of course it isn't.
You'll find life with GNAT much easier if you stick with its file naming conventions: .ads for a spec, .adb for a body, and the file name needs to be the unit name in lower case. In your case, the file should have been called hello.adb.
The simplest approach to creating a GNAT project file in GPS is to go to the Project menu and select New. The only places where you must enter data are on the "Naming the project" page (you might choose firstproject!) and the "Main files" page, where you'd click on the blue + to add hello.adb; you can Forward through the others.
After adding the main file, you can click Apply to install the new project file; now you can Build all and Run.
You may find the GPS tutorial helpful (Help menu, GPS ...)

Code does not compile for extra large implementation file

The compiler exits by throwing following error.
/var/folders/2t/jkh9ngsn6f9bnmz8l0mz0zm80000gs/T/xsdLocal20-ZhAiH9.s:1895977:branch out of range
clang: error: assembler command failed with exit code 1 (use -v to see invocation)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
The file has 98341 number of lines.
using compiler Apple LLVM 3.1
The code builds for simulator but not for iOS device
Save the original file.
Comment out out #implementation after another, til the file compiles properly. Npw you know the class that is giving you the problem.
Then take the very biggest method, adding '#if 0' around the code, and at the top before the '#if 0', return a proper value - YES, NO, nil, whatever so the file will compile.
Compile. Do you still get the problem? Then comment out the next largest method, or just do the methods sequentially, or use a binary search technique (ie comment out one half of the methods, then the other half, to drill down on the culprit.
Once you find the problem method, you will need to refactor it into two or more methods, which probably can be private to the class, so your public interface does not change.

X is ambiguous between declarations in Modules but there is only one

So, I'm working in VS 2k5 and I've been copying some code from another project into this one. It's a VB Web Application. The code compiles, but when it tries to load the first page I get this:
Compiler Error Message: BC30554: 'FormFunctions' is ambiguous.
Source Error:
Line 103: Public ReadOnly Property EditMode() As EditMode
Line 104: Get
Line 105: Return FormFunctions.GetEditMode(HiddenCodeID, IsReadOnly)
Line 106: End Get
Line 107: End Property
Source File: Y:\My Documents\Visual Studio 2005\Projects\IntranetApps.Net\WebBase\BaseApplication\App_Code\BaseUserControl.vb Line: 105
Another thing is, when I try to put a breakpoint at line 103, it never gets hit. It's like it's running some phantom code somewhere.
The only GetEdit mode I have in my project is in the module FormFunctions.
How can I tell where it's seeing two methods at run time?