Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Newbie can not compile trivial.cpp. Help!!!!: msg#00004

apache.logging.log4cxx.user

Subject: Newbie can not compile trivial.cpp. Help!!!!

Hello,

I am very much new to C++ programming in MS Windows environment. I am asked to develop a C++ application with QT 3.2.3 on Windows platform with MS Visual C++ 7.1 .Net edition. I have been developing C programs mostly on solaris and linux platforms.

After realizing that Qt 3.2.3 does not have a logging API other then some qDebug, qFatal, qWarning, I have seached for a logging library and found three different log4c++ implementation . After seaching for a while I understood that log4cxx is a part of Apache and decided to use log4cxx.

I have compiled the library as directed even though gathering eveything ant, jre, apr, cppunit took sometime.

Anyhow, I wanted to test the library, honestly for 2 days I have not been able to compile even simple examples. I receive zillions of errors that I provided in the end of the mail. I suspect that I may be missing to include some compilation flags. I used the qt qmake tool to generate a makefile as I am eventually use this tool with qt library.

In my test example I have only one file main.cpp which I have stolen form trivial.cpp (I have only changed the name of the trivial.cpp)

/*
 * Copyright 2003,2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <log4cxx/logstring.h>
#include <stdlib.h>
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/helpers/exception.h>
#include <log4cxx/ndc.h>

using namespace log4cxx;
using namespace log4cxx::helpers;

int main()
{
  int result = EXIT_SUCCESS;
  try
  {
    BasicConfigurator::configure();
    LoggerPtr rootLogger = Logger::getRootLogger();

    NDC::push("trivial context");

    LOG4CXX_DEBUG(rootLogger, "debug message");
    LOG4CXX_INFO(rootLogger, "info message");
    LOG4CXX_WARN(rootLogger, "warn message");
    LOG4CXX_ERROR(rootLogger, "error message");
    LOG4CXX_FATAL(rootLogger, "fatal message");

    NDC::pop();
  }
  catch(std::exception&)
  {
    result = EXIT_FAILURE;
  }

  return result;
}

-------------------------------------------------------

MY QT PROJECT FILE

TEMPLATE = app

# Input
CONFIG  +=  qt warn_on console thread exceptions
INCLUDEPATH += . D:\libs\log4cxx\include
LIBS = D:\libs\log4cxx\lib\log4cxx.lib
DEFINES = QT_DLL
SOURCES += main.cpp



------------------------------------------------------------

GENERATED MAKEFILE FROM PROJECT FILE ABOVE

#############################################################################
# Makefile for building: wrk
# Generated by qmake (1.06c) (Qt 3.2.3) on: Mon Aug 07 15:07:14 2006
# Project:  wrk.pro
# Template: app
# Command: $(QMAKE) -o Makefile wrk.pro
#############################################################################

####### Compiler, tools and options

CC        =    cl
CXX        =    cl
LEX        = flex
YACC        = byacc
CFLAGS    =    -nologo -Zm200 -W3 -MD -O1 -GX -GX -GR  -DQT_DLL -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
CXXFLAGS    =    -nologo -Zm200 -W3 -w34100 -w34189 -MD -O1 -GX -GX -GR  -DQT_DLL -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG
LEXFLAGS    =
YACCFLAGS    =-d
INCPATH    =     -I"." -I"D:\libs\log4cxx\include" -I"$(QTDIR)\include" -I"D:\toktay\projects\yayici\den2" -I"D:\apps\qt\3.2.3\mkspecs\win32- msvc.net"
LINK    =    link
LFLAGS    =    /NOLOGO /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /SUBSYSTEM:CONSOLE /LIBPATH:"$(QTDIR)\lib"
LIBS    =     "qt-mt323.lib" "qtmain.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib " "oleaut32.lib" "uuid.lib" "imm32.lib" "winmm.lib" "wsock32.lib" "winspool.lib" "delayimp.lib" "D:\libs\log4cxx\lib\log4cxx.lib" " opengl32.lib" "glu32.lib"
MOC        =    $(QTDIR)\bin\moc.exe
UIC        =    $(QTDIR)\bin\uic.exe
QMAKE        =    qmake
IDC        =    $(QTDIR)\bin\idc.exe
IDL        =    midl
ZIP        =    zip -r -9
COPY_FILE    =       copy
COPY_DIR    =       copy
DEL_FILE    =       del
DEL_DIR    =       rmdir
MOVE        =       move
CHK_DIR_EXISTS =    if not exist
MKDIR        =    mkdir

####### Files

HEADERS =   
SOURCES =    main.cpp
OBJECTS =    main.obj
FORMS =   
UICDECLS =   
UICIMPLS =   
SRCMOC    =   
OBJMOC    =   
DIST    =   
TARGET    =    wrk.exe

####### Implicit rules

.SUFFIXES: .c .cpp .cc .cxx .C

{.}.cpp{}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
    $<
<<

{.}.cc{}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
    $<
<<

{.}.cxx{}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
    $<
<<

{.}.C{}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo @<<
    $<
<<

{.}.c{}.obj::
    $(CC) -c $(CFLAGS) $(INCPATH) -Fo @<<
    $<
<<

####### Build rules

all: Makefile $(TARGET)

$(TARGET):  $(UICDECLS) $(OBJECTS) $(OBJMOC)
    $(LINK) $(LFLAGS) /OUT:$(TARGET) @<<
      $(OBJECTS) $(OBJMOC) $(LIBS)
<<


mocables: $(SRCMOC)
uicables: $(UICIMPLS) $(UICDECLS)

Makefile: wrk.pro  D:\apps\qt\3.2.3\mkspecs\win32-msvc.net\qmake.conf ..\..\..\..\apps\qt\3.2.3\lib\qtmain.prl
    $(QMAKE) -o Makefile wrk.pro
qmake:
    @$(QMAKE) -o Makefile wrk.pro

dist:
    $(ZIP) wrk.zip $(SOURCES) $(HEADERS) $(DIST) $(FORMS) D:/toktay/projects/yayici/den2/wrk.pro ..\..\..\..\apps\qt\3.2.3\lib\qtmain.prl 

uiclean:
mocclean:
clean: uiclean mocclean
    -$(DEL_FILE) main.obj


FORCE:

distclean: clean
    -$(DEL_FILE) $(TARGET)

####### Compile

main.obj: main.cpp

####### Install

install: all 

uninstall: 

--------------------------------------------------------------------------------------------------

THE WARNINGS THAT I RECEIVE after nmake

D:\toktay\projects\yayici\den2>nmake

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c -nologo -Zm200 -W3 -w34100 -w34189 -MD -O1 -GX -GX -GR  -DUNICODE
-DWIN32 -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"." -I"D:\libs\log4cxx\incl
ude" -I"D:\apps\qt\3.2.3\include" -I"D:\toktay\projects\yayici\den2" -I"D:\apps\
qt\3.2.3\mkspecs\win32-msvc.net" -Fo @D:\temp\nm472.tmp
main.cpp
D:\libs\log4cxx\include\log4cxx\helpers\appenderattachableimpl.h(45) : warning C
4251: 'log4cxx::helpers::AppenderAttachableImpl::appenderList' : class 'std::vec
tor<_Ty>' needs to have dll-interface to be used by clients of class 'log4cxx::h
elpers::AppenderAttachableImpl'
        with
        [
            _Ty=log4cxx::AppenderPtr
        ]
D:\libs\log4cxx\include\log4cxx\helpers\appenderattachableimpl.h(106) : warning
C4250: 'log4cxx::helpers::AppenderAttachableImpl' : inherits 'log4cxx::helpers::
ObjectImpl::log4cxx::helpers::ObjectImpl::addRef' via dominance
        D:\libs\log4cxx\include\log4cxx\helpers\objectimpl.h(32) : see declarati
on of 'log4cxx::helpers::ObjectImpl::addRef'
D:\libs\log4cxx\include\log4cxx\helpers\appenderattachableimpl.h(106) : warning
C4250: 'log4cxx::helpers::AppenderAttachableImpl' : inherits 'log4cxx::helpers::
ObjectImpl::log4cxx::helpers::ObjectImpl::releaseRef' via dominance
        D:\libs\log4cxx\include\log4cxx\helpers\objectimpl.h(33) : see declarati
on of 'log4cxx::helpers::ObjectImpl::releaseRef'
D:\libs\log4cxx\include\log4cxx\level.h(134) : warning C4251: 'log4cxx::Level::A
LL' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be
used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(140) : warning C4251: 'log4cxx::Level::F
ATAL' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to b
e used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(145) : warning C4251: 'log4cxx::Level::E
RROR' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to b
e used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(150) : warning C4251: 'log4cxx::Level::W
ARN' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be
 used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(156) : warning C4251: 'log4cxx::Level::I
NFO' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be
 used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(162) : warning C4251: 'log4cxx::Level::D
EBUG' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to b
e used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\level.h(167) : warning C4251: 'log4cxx::Level::O
FF' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be
used by clients of class 'log4cxx::Level'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\helpers\resourcebundle.h(82) : warning C4251: 'l
og4cxx::helpers::ResourceBundle::parent' : class 'log4cxx::helpers::ObjectPtrT<T
>' needs to have dll-interface to be used by clients of class 'log4cxx::helpers:
:ResourceBundle'
        with
        [
            T=log4cxx::helpers::ResourceBundle
        ]
D:\libs\log4cxx\include\log4cxx\logger.h(68) : warning C4251: 'log4cxx::Logger::
level' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to
be used by clients of class 'log4cxx::Logger'
        with
        [
            T=log4cxx::Level
        ]
D:\libs\log4cxx\include\log4cxx\logger.h(73) : warning C4251: 'log4cxx::Logger::
parent' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to
 be used by clients of class 'log4cxx::Logger'
        with
        [
            T=log4cxx::Logger
        ]
D:\libs\log4cxx\include\log4cxx\logger.h(79) : warning C4251: 'log4cxx::Logger::
resourceBundle' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-inte
rface to be used by clients of class 'log4cxx::Logger'
        with
        [
            T=log4cxx::helpers::ResourceBundle
        ]
D:\libs\log4cxx\include\log4cxx\logger.h(85) : warning C4251: 'log4cxx::Logger::
aai' : class 'log4cxx::helpers::ObjectPtrT<T>' needs to have dll-interface to be
 used by clients of class 'log4cxx::Logger'
        with
        [
            T=log4cxx::helpers::AppenderAttachableImpl
        ]
D:\libs\log4cxx\include\log4cxx\logger.h(593) : warning C4250: 'log4cxx::Logger'
 : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::addRef'
 via dominance
        D:\libs\log4cxx\include\log4cxx\helpers\objectimpl.h(32) : see declarati
on of 'log4cxx::helpers::ObjectImpl::addRef'
D:\libs\log4cxx\include\log4cxx\logger.h(593) : warning C4250: 'log4cxx::Logger'
 : inherits 'log4cxx::helpers::ObjectImpl::log4cxx::helpers::ObjectImpl::release
Ref' via dominance
        D:\libs\log4cxx\include\log4cxx\helpers\objectimpl.h(33) : see declarati
on of 'log4cxx::helpers::ObjectImpl::releaseRef'
        link /NOLOGO /DELAYLOAD:comdlg32.dll /DELAYLOAD:oleaut32.dll /DELAYLOAD:
winmm.dll /DELAYLOAD:wsock32.dll /DELAYLOAD:winspool.dll /SUBSYSTEM:CONSOLE /LIB
PATH:"D:\apps\qt\3.2.3\lib" /OUT:wrk.exe @D:\temp\nm473.tmp
LINK : warning LNK4199: /DELAYLOAD:comdlg32.dll ignored; no imports found from c
omdlg32.dll
LINK : warning LNK4199: /DELAYLOAD:oleaut32.dll ignored; no imports found from o
leaut32.dll
LINK : warning LNK4199: /DELAYLOAD:winmm.dll ignored; no imports found from winm
m.dll
LINK : warning LNK4199: /DELAYLOAD:wsock32.dll ignored; no imports found from ws
ock32.dll
LINK : warning LNK4199: /DELAYLOAD: winspool.dll ignored; no imports found from w
inspool.dll

----------------------------------------------

An execuatable is geneated but I no output written to the console when I executed.

Anyhelp would be much appreciated.

Sincerely





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation