-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
I am trying to use the ftl as key-value containers based on hashmaps, but I am having problems
getting past compiling my project. There are two containers I am trying to make. First, the interger
key, integer value container is used by this simple program
use ftlHashMapIntIntModule
implicit none
integer :: val
type(ftlHashMapIntInt) :: ids
call ids%New(10)
call ids%Set(1,20)
call ids%Set(3,20)
if (.not. ids%Has(1)) then
print *, "Ids dont have 1."
else
print *, 'IDs have 1'
val = ids%Get(1)
print *, 'Value at 1=',val
end if
end program ftlicont```
Also , there is file intIntMap.F90
```! Defines integer-integer map: ftlHashMapIntInt
#define FTL_TEMPLATE_KEYTYPE integer
#define FTL_TEMPLATE_KEYTYPE_NAME Int
#define FTL_TEMPLATE_TYPE integer
#define FTL_TEMPLATE_TYPE_NAME Int
#define FTL_INSTANTIATE_TEMPLATE
#include <ftlHashMap.F90_template>
when I compile it as
gfortran -Wall -std=f2008 -I/home/mzuniga/ftl/install/include/ftl -L/home/mzuniga/ftl/install/lib -lftl ftlicont.F90 intIntMap.F90
I get these errors upon linking (after I run the above gfortran command twice)
4 | use ftlHashMapIntIntModule
| 1
Fatal Error: Cannot open module file ‘ftlhashmapintintmodule.mod’ for reading at (1): No such file or directory
compilation terminated.
I also have a second simple program that is closer to my goal.
First I define a type in file star_mod.F90
type star_type
integer :: id
character(len=:), allocatable :: name
end type star_type
end module star_mod
and since I want an integer key, star_type value map/container, I also made this file intStarMap.F90
use star_mod, only : star_type
#define FTL_TEMPLATE_KEYTYPE integer
#define FTL_TEMPLATE_KEYTYPE_NAME Int
#define FTL_TEMPLATE_TYPE star_type
#define FTL_TEMPLATE_TYPE_NAME Star
#define FTL_INSTANTIATE_TEMPLATE
#include <ftlHashMap.F90_template>
And I would like to use the imap as in this program
use star_mod, only : star_type
use ftlHashMapIntStarModule
implicit none
integer id
type(ftlHasMapIntStar) :: stars
type(star_type), allocatable :: s1, s2, s3
s1 = star_type(1, "sA")
s2 = star_type(2, "sB")
call stars%new(10)
call stars%Set(1,s1)
if (.not. stars%Has(1)) then
print *, "Stars dont have 1."
else
print *, 'Stars have 1'
end if
end program```
and when I compile:
```gfortran -Wall -std=f2008 -fmax-errors=5 -I/home/mzuniga/ftl/install/include/ftl -L/home/mzuniga/ftl/install/lib -lftl intStarMap.F90 ftlstars.F90 star_mod.F90```
The first errors are these:
```58 | module CAT4(ftlHashMap,FTL_TEMPLATE_KEYTYPE_NAME,FTL_TEMPLATE_TYPE_NAME,Module)
| 1
Error: Unexpected MODULE statement at (1)
/home/mzuniga/ftl/install/include/ftl/ftlHashMap.F90_template:67:21:
67 | use ftlKindsModule
| 1
Error: Unexpected USE statement at (1)
/home/mzuniga/ftl/install/include/ftl/ftlHashMap.F90_template:68:20:
68 | use ftlHashModule
| 1
Error: Unexpected USE statement at (1)
/home/mzuniga/ftl/install/include/ftl/ftlHashMap.F90_template:70:16:```
Can I get some hints on compiling? Of course, ftl was compiled and installed (as per above , in installation dir ```/home/mzuniga/ftl/install/include```. Attached is a tar file of the project.
Thanks
Mike Zuniga
[ftl_proj.tar.gz](https://github.com/SCM-NV/ftl/files/6866449/ftl_proj.tar.gz)
Reactions are currently unavailable