static integer initiieren!



  • hi!

    ich habe 2 klassen. von der Klasse A moechte ich B.zahl initiieren.
    wie funktioniert das!?

    habe in B
    static int zahl;

    und in A mache ich
    B::zahl=0;

    es soll eine Zahl sein, die einmal initiiert wird, aber von der Klasse B aus. dann spaeter wird sie pro Klassenaufruf von B inkrementiert (++).

    lg,
    KITT



  • Ja, stimmt so.



  • laesst sich kompilieren, jedoch sobald ich den Xdaq-server ausfuehre (http://xdaqwiki/index.php/Main_Page), zeigt das server logfile folgendes an:

    09 Aug 2006 09:25:1155111940 [1073850176] ERROR ch.cern.gtswpc2.Executive.lid(0) <> - Caught exception: xdaq::exception::ConfigurationError 'Cannot load module from file://{XDAQ_ROOT}/trigger/subsystem/ts/cell/lib/linux/x86/libCell.so' raised at downloadModules(Executive.cc:1118); originated by xdaq::exception::Exception 'Cannot load module ///home/awinkler/TriDAS/trigger/subsystem/ts/cell/lib/linux/x86/libCell.so' raised at loadModule(ApplicationContextImpl.cc:1108); originated by xdaq::exception::LoadFailed '/home/awinkler/TriDAS/trigger/ts/framework/lib/linux/x86/libCellFramework.so: undefined symbol: \_ZN17CellCommandWidget11tabCounter\_E' raised at load(SharedObjectRegistry.cc:133) 09 Aug 2006 09:25:1155111940 [1073850176] ERROR ch.cern.gtswpc2.Executive.lid(0) <> - Failed to configure executive 09 Aug 2006 09:25:1155111940 [1073850176] ERROR ch.cern.gtswpc2.Executive.lid(0).SOAPDispatcher <> - Caught exception: xoap::exception::Exception 'Failed to configure executive' raised at Configure(Executive.cc:300); originated by xdaq::exception::Exception 'Failed to configure executive' raised at Configure(Executive.cc:243); originated by xdaq::exception::ConfigurationError 'Cannot load module from file://{XDAQ_ROOT}/trigger/subsystem/ts/cell/lib/linux/x86/libCell.so' raised at downloadModules(Executive.cc:1118);
    originated by xdaq::exception::Exception 'Cannot load module ///home/awinkler/TriDAS/trigger/subsystem/ts/cell/lib/linux/x86/libCell.so' raised at loadModule(ApplicationContextImpl.cc:1108);
    originated by xdaq::exception::LoadFailed '/home/awinkler/TriDAS/trigger/ts/framework/lib/linux/x86/libCellFramework.so: undefined symbol: _ZN17CellCommandWidget11tabCounter_E' raised at load(SharedObjectRegistry.cc:133)
    09 Aug 2006 09:25:1155111940 [1073850176] INFO ch.cern.gtswpc2 <> - Ready.

    im Headerfile CellCommandWidget.h habe ich deklariert
    static int tabCounter_;

    und in CellPage.cc initialisiere ich folgendermassen:
    CellCommandWidget::tabCounter_=0;

    lg,
    KITT



  • int CellCommandWidget::tabCounter_=0;
    

Log in to reply