Message: How to use external library(.so or .a) Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question How to use external library(.so or .a) 

Forum: Installation and Configuration
Date: 27 Nov, 2016
From: Huagang Yan <Huagang Yan>

Hi, Experts,

I introduced a class in my application which uses an external also exists after building the lib), which was installed in its default path(/usr/local/lib). I did what the Geant4 Users' Guide says, i.e, edited the GNUmakefile as follows:

# --------------------------------------------------------------------
# GNUmakefile for the application "sim" depending on module "Xplotter"
# --------------------------------------------------------------------
name := exampleB1 G4TARGET := $(name) G4EXLIB := true CPPFLAGS += -I/usr/local/include EXTRALIBS += -L/usr/local/lib -lxxx EXTRA_LINK_DEPENDENCIES := /usr/local/lib/libxxx.a

.PHONY: all all: lib bin include $(G4INSTALL)/config/binmake.gmk .....

Then I used cmake to build the project in a build directory, and opened it in Eclipse. After clicking build, the following error information appeared:

undefined reference to 'xxxxx1' undefined reference to 'xxxxx2' ...

xxxxx's are methods defined in the header file associated with the library. In Eclipse, I added the library path and library, and set LD_LIBRARY_PATH = /usr/local/lib. But none of the efforts work. I was thinking of editing the Makefile directly. However, it is too complicated to modify without undesired consequence.

I have been working on this issue for days, really exhausted, and I think it shouldn't be a big problem, as the example applying the xxx library works just as expected.

Any help is highly appreciated.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Note: Re: How to use external library(.so or .a)   (Ben Morgan - 29 Nov, 2016)
(_ Feedback: Re: How to use external library(.so or .a)   (Huagang Yan - 30 Nov, 2016)
 Add Message Add Message
to: "How to use external library(.so or .a)"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]