Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:50:06+00:00 2026-05-26T22:50:06+00:00

Having trouble using libstatgrab — I receive the following error at compile time: libstatgrabTest.cpp:16:

  • 0

Having trouble using libstatgrab — I receive the following error at compile time:

"libstatgrabTest.cpp:16: undefined reference to sg_get_process_stats"

I’m guessing it is because I need to include it’s .so files at the linking state — although I’m not sure. As you can see below, I am currently including the statgrab.h header file. I performed configured && make && make install for the library.

If I search for libstatgrab*, I come across the following:

./usr/local/lib/libstatgrab.so.6.2.3
./usr/local/lib/libstatgrab.la
./usr/local/lib/libstatgrab.so.6
./usr/local/lib/libstatgrab.a
./usr/local/lib/libstatgrab.so.6.2.2
./usr/local/lib/libstatgrab.so
./usr/local/lib/pkgconfig/libstatgrab.pc

Another search for statgrab* returns the following (relevant items only):

./usr/local/bin/statgrab
./usr/local/include/statgrab_deprecated.h
./usr/local/include/statgrab.h

At compilation, I run: g++ -g -c libstatgrabTest.cpp

At linking, I run: g++ -L/usr/local/lib libstatgrab.o -o libstatgrabTest

Any idea what I am doing wrong? The code within libstagrabTest.cpp is shown below:

// external libraries
#include <statgrab.h> // libstatgrab (http://www.i-scream.org/libstatgrab/)

// namespace
using namespace std;

int main(void) {
  // try to initalize libstatgrab

  int * entries;
  sg_process_stats * systemStats = sg_get_process_stats(entries);

  // return
  return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:50:07+00:00Added an answer on May 26, 2026 at 10:50 pm
    g++ -L/usr/local/lib libstatgrab.o -o libstatgrabTest
    

    should be (tested with your code snipper on Ubuntu Natty):

    g++ -L/usr/local/lib -o libstatgrabTest -lstatgrab
    

    or, to link statically:

    g++ -L/usr/local/lib -o libstatgrabTest /usr/lib/libstatgrab.a
    

    Tested both on my box, with your exact source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble using os.utime to correctly set the modification time on the mac
I'm having trouble using the Core Plot framework in my project. I tried following
I am having trouble using a container with my custom class. Every time I
I am having trouble using script/generate . I am following the tree based navigation
I'm having trouble using Joda Time's PeriodFormatter. I want one to report days, hours,
Im having trouble using a .NET COM in vb6, It compiles ok and I
I am using mssql and am having trouble using a subquery. The real query
I am having trouble using the attribute XPath Selector in ElementTree, which I should
I'm having trouble using the flowlayoutPanel in a C# winform application. What I basically
I've been having trouble using cucumber and webrat to test authlogic-openid authentication in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.