When I try to use gettext in vala I get not errors or warnings from vala but I get the following error from the c compiler:
/usr/include/glib-2.0/glib/gi18n-lib.h:29:2: error: #error You must define GETTEXT_PACKAGE before including gi18n-lib.h. Did you forget to include config.h?
How can I fix this?
To solve this problem I had to both add -X -DGETTEXT_PACKAGE="..." to the valac command and add const string GETTEXT_PACKAGE = "..."; to the top of my source file.
If I don't add that to the top of my source file, I get lots of undeclared (first use in this function) errors from the C compiler for some reason.
I do, however, get a warning from the C compiler for redefining GETTEXT_PACKAGE.
I think the most common solution is to just pass -DGETTEXT_PACKAGE="..." to the C compiler (if you're just relying on valac to invoke it, pass -X -DGETTEXT_PACKAGE="..." to valac).
This can help: https://bugzilla.gnome.org/show_bug.cgi?id=618931
Related
I'm trying to generate C code for a simple function Matlab funciton:
function[] = myfunc()
%#codegen
fprintf('Executing myfun\n');
fid = fopen('file_created_by_myfun.txt','w');
fwrite(fid,'This is written by myfun upon execution');
fclose(fid);
end
However, in the generated code a variable type boolean_T is used but not declared anywhere. It seems to me that no header with its declaration was included.
The script to generate the code is:
config_obj = coder.config('exe');
config_obj.GenCodeOnly = 'on';
codegen -config config_obj myfun
By calling make with a custom makefile, I get the following error messages:
error: unknown type name 'boolean_T'
error: 'false' undeclared (first use in this function)
error: 'true' undeclared (first use in this function)
I can ask for single file and add custom code with:
config_obj = coder.FilePArtitioningMethod('SingleFile');
config_obj.CustomSourceCode = ['typedef unsigned int boolean_T;',newline,...
'#define true 1U',newline,...
'#define false 0U'];
This will allow me to compile the code properly, but it's a crappy solution, since I don't want to generate a single file, and the added source is not included in every file as needed.
Is there any way I can avoid having the boolean_T type being used? Or there some directive I should have used but I'm missing?
boolean_T and possibly other types like int_T are defined in header files that are not generated, but shipped with MATLAB. Usually the definitions are in tmwtypes.h which you can find in /extern/include. The generated makefile includes a path to this in the list of include directories as an option to the compiler. If you are not using the generated makefile you would need to add the paths to these headers manually to your compiler options.
Why sometimes when I try to print in console like this:
po trip.id
I get:
error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {
^~~~~~~~~~~~~~~
<EXPR>:16:5: error: use of unresolved identifier '$__lldb_injected_self'
$__lldb_injected_self.$__lldb_wrapped_expr_79(
^~~~~~~~~~~~~~~~~~~~~
or
error: <EXPR>:1:11: error: cannot find type '$__lldb_context' in scope
extension $__lldb_context {
^~~~~~~~~~~~~~~
Any way to fix it?
In order to have expression run as though it were injected into the currently selected frame, we need to construct a context (some kind of class extension, for instance) with an appropriate self parameter, and evaluate the code in your expression in that context. Apparently, the context in which you are trying to print "trip.id" is one the debugger can't reconstruct. If you can file a bug with http://bugreporter.apple.com to report this, we can figure out how to support this.
If you aren't using Xcode 8.0, you might try that, a bunch of bugs of this sort were fixed.
lldb has another command, "frame variable" which provides quick access to local variables. It can't run function calls and the like, but since it is less ambitious it is sometimes more robust. You might try something like:
(lldb) frame variable -O trip.id
When I'm trying to define a macro in code, compiler says this:
refix/mod.rs:12:1: 12:12 error: macro definitions are not stable enough for use and are subject to change
refix/mod.rs:12 macro_rules! re_fix(
^~~~~~~~~~~
refix/mod.rs:12:1: 12:12 note: add #[feature(macro_rules)] to the crate attributes to enable
refix/mod.rs:12 macro_rules! re_fix(
I've added a lot of #[feature(macro_rules)], but it didn't help.
Source code: https://gist.github.com/suhr/11207656
PS: yes, they're probably a lot of other errors there, but I am interested about this one.
I think that error message is somewhat misleading. You have to add #![feature(macro_rules)] to your main crate module (note the exclamation sign), along with #![crate_id=...] and others.
#![crate_id="rsfix#0.0"]
#![feature(macro_rules)]
macro_rules! example( ... )
fn main() {
example!(...);
}
This should work on the latest compiler version.
I am getting build error while using stricmp to compare two C strings in Xcode.
Error : Implicit declaration of stricmp invalid in C99. What is it means?
What it means is that a declaration of stricmp cannot be found in the headers you have included. Earlier versions of C allowed you to call functions that were not declared in the headers and assumed that they were declared as int function()
stricmp is not in the C or POSIX standards. For iOS look at strcasecmp() as per this SO question
I'm writing simple chat program in Ada, and I'm having problem with chat window simulation - on button clicked it reads text form entry and puts it on text_view. Here is the code I've written and here is the compile output:
gnatmake client `gtkada-config`
gcc -c -I/usr/include/gtkada client_pkg.adb
client_pkg.adb:14:19: no candidate interpretations match the actuals:
client_pkg.adb:14:37: expected private type "Gtk_Text_Iter" defined at gtk-text_iter.ads:48
client_pkg.adb:14:37: found type "Gtk_Text_View" defined at gtk-text_view.ads:58
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:568
client_pkg.adb:14:37: ==> in call to "Get_Buffer" at gtk-text_buffer.ads:407
client_pkg.adb:15:34: no candidate interpretations match the actuals:
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:283
client_pkg.adb:15:34: missing argument for parameter "Start" in call to "Get_Text" declared at gtk-text_buffer.ads:270
gnatmake: "client_pkg.adb" compilation error
Can anyone tell me what is the problem, since I have no idea why procedure Get_Buffer expects Gtk_Text_Iter, and why Get_Text miss Start parameter?
You have to call the correct procedures/functions.
In your example, you call Gtk.Text_Buffer.Get_Buffer, not the correct Gtk.Text_View.Get_Buffer. This is because you with and use Gtk.Text_Buffer, but don't use Gtk.Text_View. You should be careful what you use. Same for Get_Text.
If you add use clauses for Gtk.Text_View and Gtk.GEntry, those errors should disappear.
But I give you an advice: try to use as few as possible use clauses. That way you always know what function is really called.
TLDR: Add use Gtk.Text_View; use Gtk.GEntry; to the declaration part of the On_Btn_Send_Clicked procedure.