News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Build option [Solved]

Started by bijanbina, January 10, 2011, 04:54:30 PM

Previous topic - Next topic

bijanbina

Hi i write a program that write a message in gnome as notification bar

i can compile it in Terminal with command

gcc `pkg-config --cflags gtk+-2.0` `pkg-config --cflags glib-2.0` -lnotify main.c -o hi

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

#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;
}



-------------------------------------------------------------------------------------------
Solution:Go to Project -> Build options  In linker setting add notify

oBFusCATed

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

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
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