1

I want to use a non standard library ( igraph C library ) to build a 'hello world' program in C++, using Netbeans.

I want to use Debug features of Netbeans too.

First I followed the installation instructions provided by the library vendor, used a terminal to compile and run a hello world program supplied by library vendor. It compiles & runs fine using terminal.

The problem is as soon as I open the C project file in Netbeans, I must CONFIGURE it so that it can :

  1. Run the program
  2. Debug the program

Netbeans lets you run and debug C++ programs off the bat, if you using their standard libraries. But I read on some forums that some configuration needs to be done if I want to make Netbeans run and debug C++ programs containing non standard libraries

Tushar Goswami
  • 753
  • 1
  • 8
  • 19
  • If the library is built with debug symbols, as long as it's on the library path that Netbeans uses (usually this falls back to somewhere in your project or on your PATH), it should find it. Have you tried it? – Ryan J May 08 '15 at 06:31
  • I found a solution to the problem. Thanks for help Ryan! I am posting the solution in a while.. – Tushar Goswami May 08 '15 at 06:44

1 Answers1

0

I found the answer. Here are the steps :

1. Find out where your non standard library files are installed

On my Ubuntu I used the following command to find out the location of my installed files :

pkg-config --libs --cflags igraph

In above command you have to substitute igraph with name of YOUR non standard library that you installed.

This command gave me following output :

-I/usr/local/include/igraph  -L/usr/local/lib -ligraph

I noted down the path after -I, the path after -L and the string after -l. These 3 need to be fed inside Netbeans in the steps below

source: http://igraph.org/c/doc/igraph-tutorial.html#idm470953198960

2. Configure Netbeans

Right click on Project in Netbeans -> properties -> Linker ->Libraries -> Add option -> Other -> type -ligraph in here

In your case you have to type what you found instead of -ligraph on your system during step #1

Project -> properties -> Linker -> Additional Library Directories > I typed /usr/local/lib in here

In your case you have to use the path you got on your system after -L flag in step #1

Project -> properties -> C++ Compiler -> Include Directories -> I typed /usr/local/include/igraph in here

In your case you have to use the path you got on your system after -I flag in step #1

source: https://stackoverflow.com/a/13292276/3143538

add to the Project->Properties->Run->Environment :

Name: LD_LIBRARY_PATH
Value: $LD_LIBRARY_PATH:/usr/local/lib

instead of /usr/local/lib you have to use the path you got after -L flag in step #1

source: https://askubuntu.com/questions/267071/ld-library-path-specification

After above steps, I am able to both compile, run, and debug the program

Community
  • 1
  • 1
Tushar Goswami
  • 753
  • 1
  • 8
  • 19