[Clas_offline] C++ fnc call from Fortran

Hovannes Baghdasaryan bhovik at jlab.org
Fri Dec 11 16:06:16 EST 2009


libgfortran is in /usr/lib
So you should do -L/usr/lib -lgfortran

 				with best regards Hovhannes

           *********************************
           *                               *
           *     Hovhannes Baghdasaryan    *
           *             UVA               *
           *      12000 Jefferson ave.     *
           *          Room C113            *
           *     Newport News, VA, 23606   *
           *            USA                *
           *    work phone:(757) 269-7735  *
           *  	                          *
           *********************************

On Fri, 11 Dec 2009, Eugene Pasyuk wrote:

> It could not find gfortrna library
>
> Try this:
> Replace
> g++ -o test_run test_f.o test_c++.o
> with
> gfortran -o test_run test_f.o test_c++.o
>
> -Eugene
>
> Taisiya Mineeva wrote:
>> Dear All,
>>
>> Thank you for your prompt reponse.
>>
>> As for the test programm following compiles/links and produces correct
>> output:
>>> g++ -c test_c++.cc
>>> g77 -c test_f.f
>>> g++ -o test_run test_f.o test_c++.o
>>
>> When using gfortran instead of g77, I have following:
>>> g++ -c test_c++.cc
>>> gfortran -c test_f.f
>>> g++ -o test_run test_f.o test_c++.o
>> test_f.o: In function `mymain_':
>> test_f.f:(.text+0x2e): undefined reference to `_gfortran_copy_string'
>> collect2: ld returned 1 exit status
>>
>> I am not an expert with fortran, but for the reference, the test programm
>> is in : /u/home/mineeva/Lepto/TEST.
>>
>> Thank you in advance,
>> Taya
>>
>>
>>> Hello,
>>>
>>> I am writing to you with the question concerning calling a C++/ROOT
>>> function in Fortran code.
>>>
>>> I have a working test example of an external C++ function that is called
>>> in Fortran. This compiles/links well with g77/g++. However, the same
>>> procedure for compiling and linking does not work with gfortran/g++.
>>>
>>> My problem is that in order to compile Lepto generator (Fortran), where I
>>> am calling a C++ fnc, I need to use a set of cernlibs that have been
>>> compiled with gfortran. But the call in Fortran to C++ function does not
>>> compiles with gfortran.
>>>
>>> I would appreciate some guidance as to how proceed with gfortran/g++ on
>>> JLab CUE to call C++ from Fortran.
>>>
>>> Thank you in advance,
>>> Taya
>>>
>>>
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> Clas_offline mailing list
>> Clas_offline at jlab.org
>> https://mailman.jlab.org/mailman/listinfo/clas_offline
> _______________________________________________
> Clas_offline mailing list
> Clas_offline at jlab.org
> https://mailman.jlab.org/mailman/listinfo/clas_offline
>


More information about the Clas_offline mailing list