2011-01-07 1 views
2

Ich möchte diese Software kompilieren: http://snap.stanford.edu/snap/download.html auf Ubuntu 9.10 Server.undefinierter Verweis auf `clock_gettime '. Das Hinzufügen von LIBRTDEF = -lrt zu Makefile repariert es nicht

Mein Makefile:

# 
# Makefile for non-Microsoft compilers 
# 

## Linux (uncomment the 2 lines below for compilation on Linux) 
CXXFLAGS += -std=c++98 -Wall 
LDFLAGS += -lrt 
LIBRTDEF=-lrt 
## CygWin (uncomment the 2 lines below for compilation on CygWin) 
#CXXFLAGS += -Wall 
#LDFLAGS += 

all: MakeAll 

opt: CXXFLAGS += -O4 
opt: LDFLAGS += -O4 
opt: MakeAll 

MakeAll: 
# $(MAKE) -C cascades 
    $(MAKE) -C centrality 
    $(MAKE) -C community 
    $(MAKE) -C concomp 
    $(MAKE) -C forestfire 
    $(MAKE) -C krongen 
    $(MAKE) -C kronfit 
    $(MAKE) -C mkdatasets 
    $(MAKE) -C motifs 
    $(MAKE) -C ncpplot 
    $(MAKE) -C netevol 
    $(MAKE) -C netstat 
    $(MAKE) -C testgraph 

clean: 
# $(MAKE) clean -C cascades 
    $(MAKE) clean -C centrality 
    $(MAKE) clean -C community 
    $(MAKE) clean -C concomp 
    $(MAKE) clean -C forestfire 
    $(MAKE) clean -C krongen 
    $(MAKE) clean -C kronfit 
    $(MAKE) clean -C mkdatasets 
    $(MAKE) clean -C motifs 
    $(MAKE) clean -C ncpplot 
    $(MAKE) clean -C netevol 
    $(MAKE) clean -C netstat 
    $(MAKE) clean -C testgraph 

Mein Fehler:

[email protected]:~/snap/examples$ make 
make -C centrality 
make[1]: Entering directory `/hpcdrive/homes/marc.riera/snap/examples/centrality' 
g++ -o centrality centrality.cpp Snap.o -I../../glib -I../../snap 
Snap.o: In function `TSysTm::GetMSecsFromOsStart()': 
Snap.cpp:(.text+0x4b908): undefined reference to `clock_gettime' 
Snap.o: In function `TSysTm::GetProcessMSecs()': 
Snap.cpp:(.text+0x4b98e): undefined reference to `clock_gettime' 
Snap.o: In function `TSysTm::GetThreadMSecs()': 
Snap.cpp:(.text+0x4ba16): undefined reference to `clock_gettime' 
Snap.o: In function `TSysTm::GetPerfTimerTicks()': 
Snap.cpp:(.text+0x4baa9): undefined reference to `clock_gettime' 
Snap.o: In function `TSysProc::Sleep(unsigned int const&)': 
Snap.cpp:(.text+0x4bb63): undefined reference to `clock_nanosleep' 
collect2: ld returned 1 exit status 
make[1]: *** [centrality] Error 1 
make[1]: Leaving directory `/hpcdrive/homes/marc.riera/snap/examples/centrality' 
make: *** [MakeAll] Error 2 

Jede Idee?

danke.

Antwort

6

Sie haben ein Stück aus dem Haupt-Makefile und nicht aus dem Makefile in das Verzeichnis centrality eingefügt, das das Kompilieren durchführt.

Try this:

cd centrality 
g++ -o centrality centrality.cpp Snap.o -I../../glib -I../../snap -lrt 

und wenn das funktioniert, fügen Sie die LDFLAGS in diesem Make-Datei auf die zentrale/Makefile

+0

Ja. Das war's. Vielen Dank. mein Fehler. – permalac

Verwandte Themen