Author Topic: Build option [Solved]  (Read 2427 times)

Offline bijanbina

  • Single posting newcomer
  • *
  • Posts: 5
Build option [Solved]
« on: January 10, 2011, 04:54:30 pm »
Hi i write a program that write a message in gnome as notification bar

i can compile it in Terminal with command

Code: [Select]
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

Code: [Select]
#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
« Last Edit: January 11, 2011, 12:37:46 pm by bijanbina »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12831
    • Travis build status
Re: Build option
« Reply #1 on: January 10, 2011, 06:01:57 pm »
(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!]

Offline bijanbina

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build option
« Reply #2 on: January 11, 2011, 04:11:58 am »
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

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Build option
« Reply #3 on: January 11, 2011, 08:11:02 am »
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.

Offline bijanbina

  • Single posting newcomer
  • *
  • Posts: 5
Re: Build option
« Reply #4 on: January 11, 2011, 12:32:48 pm »
thanks it works!