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

  • SEARCH
  • Home
  • 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 4619540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:26:17+00:00 2026-05-22T02:26:17+00:00

Newish C++ programmer here. I am creating a QT4 application and it’s gotten large

  • 0

Newish C++ programmer here. I am creating a QT4 application and it’s gotten large enough to where I want to start using log4cplus. I think I’m close but qmake is still not cooperating.

I am running on a Windows machine, and I compiled log4cplus as a static library under cygwin ($ ./configure --enable-static).

First Question
When I compiled log4cplus I got two files.

  • liblog4cplus.a
  • liblog4cplus.dll.a

Do I need to include both of them? What’s with the .dll.a file?

Second Question
When I compile moc succeeds but gcc fails when trying to use any of log4cplus classes. I’m not sure if it can’t find the header files or if it can’t find the actual library.

g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\Qt\2010.05\qt\include\QtCore" -I"..\..\..\Qt\2010.05\qt\include\QtGui" -I"..\..\..\Qt\2010.05\qt\include" -I"external" -I"..\..\..\Qt\2010.05\qt\include\ActiveQt" -I"debug" -I"..\..\..\Qt\2010.05\qt\mkspecs\win32-g++" -o debug\qrc_tilex.o debug\qrc_tilex.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\tilex.exe object_script.tilex.Debug  -L"c:\work\workspace\tilex\lib" -L"c:\Qt\2010.05\qt\lib" -lmingw32 -lqtmaind -Lliblog4cplus.a -lQtGuid4 -lQtCored4 
./debug\main.o: In function `Z5qMainiPPc':
C:\work\workspace\tilex/main.cpp:37: undefined reference to `log4cplus::Logger::getDefaultHierarchy()'
C:\work\workspace\tilex/main.cpp:37: undefined reference to `log4cplus::BasicConfigurator::BasicConfigurator(log4cplus::Hierarchy&)'
C:\work\workspace\tilex/main.cpp:51: undefined reference to `log4cplus::BasicConfigurator::~BasicConfigurator()'
C:\work\workspace\tilex/main.cpp:51: undefined reference to `log4cplus::BasicConfigurator::~BasicConfigurator()'
mingw32-make[1]: Leaving directory `C:/work/workspace/tilex'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\tilex.exe] Error 1
mingw32-make: *** [debug] Error 2

My project resides in C:\work\workspace\tilex.

and my directory structure is this:

tilex
     /lib
         /<*.a files>
     /external
              /log4cplus
                        /<header files>

Relevant portion of my .pro file. (I’ve tried several permutations of all these variables, and still get the same result)

INCLUDEPATH += C:\\work\\workspace\\tilex\\external
QMAKE_LIBDIR += C:\\work\\workspace\\tilex\\lib
LIBS += -Lliblog4cplus.a

My main file (which compiles and runs fine without log4cplus).

#include "Tilex.h"
#include <QtGui>
#include <QApplication>

#include <log4cplus/logger.h>
#include <log4cplus/configurator.h>

using namespace log4cplus;

int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(tilex);
    QApplication app(argc, argv);

    // Fails
    BasicConfigurator config;
//    config.configure();
//    Logger::getInstance()
//    Logger logger = Logger::getInstance("main");
//    LOG4CPLUS_WARN(logger, "Hello, World!");
    // !

    Tilex mainWin;
    mainWin.show();
    return app.exec();
}
  • 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-22T02:26:18+00:00Added an answer on May 22, 2026 at 2:26 am

    Assuming everything else is correct, you should change your LIBS to this:

    LIBS += -llog4cplus
    

    The -L flag tells g++ to set a path to look for libraries. The -l flag tells it to link a specified library (with the lib- prefix and the filetype removed).

    If by you mean large as in size instead of complexity when you are saying your application is getting ‘large’, you might want to ask yourself why you are using static linking in the first place (look at this thread).

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

Sidebar

Related Questions

I am creating a map using the new(ish) v3 of the Google Maps API
I am using beautifulsoup, and I am getting some htmlparser errors with start tags
Here is how our Tomcat webserver is currently setup. We are using jsp for
Hello I am newish to android dev, I am using Eclipse and I have
I'm trying to build an application using the new-ish Pyramid framework . I'm new
Newish to mysql DBs here. I have a table of USERS and a table
Newish to Oracle programming (from Sybase and MS SQL Server). What is the Oracle
I'm newish to TFS and am working with VS and TFS 2010 RC releases.
I'm a new-ish C++ programmer, and I'm doing my first program on my own
Newish to shell scripting I've noticed that the syntax error report for an unexpected

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.