mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-08-25 06:31:44 +02:00
Solved linking problem by including C++ standard library '-lstdc++'. Also added a minimal working example of Fortran-C++ interfacing in dir 'mwe'.
This commit is contained in:
parent
84fffdb7fa
commit
f1641dd4e4
14
Makefile
14
Makefile
@ -1,8 +1,8 @@
|
||||
CXX=icpc
|
||||
CXXFLAGS=-O0 -debug full -traceback
|
||||
FC=ifort
|
||||
FFLAGS=-O0 -debug full -traceback
|
||||
# ARCH=-xCORE-AVX2
|
||||
CXX = icpc
|
||||
CXXFLAGS = -O0 -debug full -traceback
|
||||
FC = ifort
|
||||
FFLAGS = -O0 -debug full -traceback
|
||||
# ARCH = -xCORE-AVX2
|
||||
|
||||
## Deps & objs for the C++ stuff
|
||||
cppDEPS = cppmain.cpp SM_MaponiA3.cpp SM_MaponiA3.hpp Helpers.hpp
|
||||
@ -11,6 +11,8 @@ cppOBJ = cppmain.o SM_MaponiA3.o
|
||||
## Deps & objs for the Fortran stuff
|
||||
fDEPS = fmain.f90 SM_MaponiA3_mod.f90
|
||||
fOBJ = SM_MaponiA3.o SM_MaponiA3_mod.o fmain.o
|
||||
fLIBS = -lstdc++
|
||||
|
||||
|
||||
## Compile recipes for C++ stuff
|
||||
%.o: %.cpp $(cppDEPS)
|
||||
@ -36,4 +38,4 @@ cppSherman-Morrison: $(cppOBJ)
|
||||
|
||||
## Linking Fortran example program calling the C++ function 'Sherman_Morrison()'
|
||||
fSherman-Morrison: $(fOBJ)
|
||||
$(FC) $(ARCH) $(FFLAGS) -o $@ $^
|
||||
$(FC) $(ARCH) $(FFLAGS) $(fLIBS) -o $@ $^
|
||||
|
1
mwe/compile.sh
Executable file
1
mwe/compile.sh
Executable file
@ -0,0 +1 @@
|
||||
icpc -c worker.cpp && ifort -c main.f90 && ifort -lstdc++ worker.o main.o -o test
|
12
mwe/main.f90
Normal file
12
mwe/main.f90
Normal file
@ -0,0 +1,12 @@
|
||||
program test
|
||||
use iso_c_binding
|
||||
implicit none
|
||||
|
||||
interface
|
||||
subroutine hello() bind(C, name="worker")
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
call hello()
|
||||
|
||||
end program test
|
7
mwe/worker.cpp
Normal file
7
mwe/worker.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "worker.h"
|
||||
|
||||
void worker()
|
||||
{
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
}
|
||||
|
6
mwe/worker.h
Normal file
6
mwe/worker.h
Normal file
@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void worker();
|
||||
}
|
Loading…
Reference in New Issue
Block a user