User forums > Help
Build option [Solved]
(1/1)
bijanbina:
Hi i write a program that write a message in gnome as notification bar
i can compile it in Terminal with command
--- Code: ---gcc `pkg-config --cflags gtk+-2.0` `pkg-config --cflags glib-2.0` -lnotify main.c -o hi
--- End code ---
but in code block i got error because i don't know how set this option in code::block can you help me
i set this options in build option window at other option tab but it doesn't work!
and in below u can see my code
--- Code: ---#include <libnotify/notify.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char * argv[] )
{
NotifyNotification *n;
notify_init("Basics");
n = notify_notification_new ("Summary",
"This is the message that we want to display",
NULL, NULL);
notify_notification_set_timeout (n, 5000); // 5 seconds
if (!notify_notification_show (n, NULL))
{
fprintf(stderr, "failed to send notification\n");
return 1;
}
g_object_unref(G_OBJECT(n));
return 0;
}
--- End code ---
-------------------------------------------------------------------------------------------
Solution:Go to Project -> Build options In linker setting add notify
oBFusCATed:
Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
And the C::B's manual
bijanbina:
--- Quote from: oBFusCATed on January 10, 2011, 06:01:57 pm ---Read this: http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F
And the C::B's manual
--- End quote ---
thanks but in your first link it said that how we can see the compiler output and i look for my problem in C::B's manual but i couldn't find it
Jenna:
C::B always uses two passes.
building and linking.
For building the "pkg-config"-commands have to go into "Project -> Build options... -> [Project or target] -> Compiler settings -> Other options",
for linking into "Project -> Build options... -> [Project or target] -> Linker settings -> Other linker settings:",
The library goes into "Project -> Build options... -> [Project or target] -> Linker settings -> Link libaries" (in your case it should be enough to just add notify).
For the pkg-config commands, don't forget the backticks.
Full commandline-logging helps you to see what commands are used to invoke the compiler, so you can easily fix possible errors.
bijanbina:
thanks it works!
Navigation
[0] Message Index
Go to full version