Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
//============================================================================
// Name        : testlog.cpp
// Author      : rumeel
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <stdio.h>
#include <stdlib.h>
#include <log4cpp/category.hh>
#include <log4cpp/FileAppender.hh>
#include <log4cpp/SimpleLayout.hh>
 
#define LOGFILE "/home/user/test.log"
 
int main()
{
/*Setting up Appender, layout and Category*/
log4cpp::Appender *appender = new log4cpp::FileAppender("FileAppender",LOGFILE);
 
log4cpp::Layout *layout = new log4cpp::SimpleLayout();
log4cpp::Category& category = log4cpp::Category::getInstance("Category");
 
appender->setLayout(layout);
category.setAppender(appender);
category.setPriority(log4cpp::Priority::INFO);
 
category.info("This is for tracing the flow");
category.notice("This is to notify certain events");
category.warn("This is to generate certain warnings");
}


when i try to run this project then this error is occurred.so plz help me to solve this error
/usr/bin/ld: cannot find -lpkgconfig
Posted
Updated 3-Jan-12 0:41am
v3

Hi,

It looks like the GCC linker is unable to find the pkg-config library[^].

Depending on what distro you are using... you should be able to install this package using yum,rpm or maybe apt-get. Or you could optionally download and compile the package and 'make' it.

Best Wishes,
-David Delaune
 
Share this answer
 
Comments
prince_rumeel 3-Jan-12 4:03am    
bro can u give a download link for download log4cpp.deb i already tried alot.
but library is not compleat.
after that when i try to install pkg-config
then it not compleatly install in my system there is not a file present with name
pkg-config.so

plz give me download links
markkuk 3-Jan-12 6:40am    
Have you read the answers and comments to your previous questions on this same subject? What Linux distribution are you using and why aren't you using the distro's package management system to install software?
You don't use pkg-config that way. There's no "libpkgconfig" you could link with your code. Read the pkg-config documentation[^] and fix your Makefile.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900