Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] eclipse photran: cannot find library

​Hi Viktoria


Beware of the difference of -l and -L as arguments to gfortran. -l specifies a library, -L specifies a library path.


So the correct gfortran line in your case would be


gfortran  -o "ca-test-2"  ./src/ca.o -L"/home/verfurt/Schreibtisch/ws-f-calight-v642/ca-test-2/lib/"  -l"LChemApp"


So how to get eclipse to use those options? Under Library Paths add


/home/verfurt/Schreibtisch/ws-f-calight-v642/ca-test-2/lib/


and under Libraries add


LChemApp


If you still run into problems, run the gfortran command that causes the problem from the command line and figure out what the correct paths and file names are and then set those options in eclipse.


Cheers


Benedikt



Link Options - Using the GNU Compiler Collection (GCC)
Using the GNU Compiler Collection (GCC)




From: photran-bounces@xxxxxxxxxxx <photran-bounces@xxxxxxxxxxx> on behalf of Erfurt, Viktoria <v.erfurt@xxxxxxxxxxxxx>
Sent: Tuesday, May 26, 2015 3:50 AM
To: 'photran@xxxxxxxxxxx'
Subject: [photran] eclipse photran: cannot find library
 

Dear all,

 

can you please help me to link a library to my project? I’m new with using eclipse and programming fortran. I have download eclipse and photran:

 

Eclipse for Parallel Application Developers

Version: Luna Service Release 2 (4.4.2)

Build id: 20150219-0600

 

It works so far. And I can compile a small “Hello World!” program without any problems. I want to use a library (name: libLChemApp.a) in my eclipse project. The same library works in a non-eclipse project on the same machine without any problems. I have put the library in my workspace. My directory tree looks like this:

 

ca-test-2: <- project

-          lib <- here is the library

-          src

-          debug

-          release

 

Now I have to tell the compiler where the library is which I want to use. How can I do it?

 

I have tried:

Project->Properties

Fortran General->Paths and Symbols

 

Includes: Add…

Directory: /ca-test-2/lib

The options: ‘Add to all configurations’, ‘Add to all languages’ and ‘Is a workspace path’ are enabled.

 

Libraries: Add…

File: ${workspace_loc:/ca-test-2/lib/libLChemApp.a}

The options: ‘Add to all configurations’, ‘Add to all languages’ and ‘Is a workspace path’ are enabled.

 

If I build the project I get an error:

 

13:36:02 **** Incremental Build of configuration Debug for project ca-test-2 ****

make all

Building target: ca-test-2

Invoking: GNU Fortran Linker

gfortran  -o "ca-test-2"  ./src/ca.o   -l"/home/verfurt/Schreibtisch/ws-f-calight-v642/ca-test-2/lib/libLChemApp.a"

/usr/bin/ld: cannot find -l/home/verfurt/Schreibtisch/ws-f-calight-v642/ca-test-2/lib/libLChemApp.a

collect2: Fehler: ld gab 1 als Ende-Status zurück

make: *** [ca-test-2] Fehler 1

 

13:36:02 Build Finished (took 231ms)

 

But the library is in the workspace. Why cannot the compiler find it? What do I do wrong?

 

With best regards,

Viktoria



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


Back to the top