Open MitchelDaniel opened 10 months ago
Sounds like a linking problem. How did you compilation go?
Compilation failed. output is in first post. I will edit to make clearer
My question was what commands you ran at command line
I have a makefile, the compilation command (see LIBS for my linking with refprop):
#NOTE ... a tab character is REQUIRED at the beginning of every recipe line
# Action ... : prerequisites ...
# <tab>recipe
TARGET = flowcalc
# define the compiler to be used
CC = gcc
FC = gfortran
# debug
DEBUG = -g
# warnings
WARN = -Wall
CFLAGS = $(WARN) $(DEBUG) `pkg-config --cflags gtk+-3.0`
FFLAGS = $(WARN) $(DEBUG) `pkg-config --cflags gtk+-3.0`
GTKLIB = `pkg-config --cflags --libs gtk+-3.0`
# define any libraries to link into executable
LIBS = -lm -lgfortran /usr/local/lib/librefprop.so \
/usr/local/lib/libmodbus.so -lpthread -fPIC $(GTKLIB)
# this rule keeps make from doing something with files
# called "clean" or "all" or "default"
.PHONY: clean all default fRefProp.o fSetNew.o
#all: default
# change the list of all C source files into a list of object files
COBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
# change the list of all fortran source files into a list of object files
FOBJECTS = $(patsubst %.for, %.o, $(wildcard *.for))
# create a list of all header files
HEADERS = $(wildcard *.h)
# the .o files depend on all .c and .h files
# generate the .o files using CC (gcc) and CFLAGS (-Wall -g)
# -c ... generate the object files
# -o $@ ... put the output of the compilation in the file named left of the :
# the $< ... the first item in the dependencies list
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.for
$(FC) $(FFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(COBJECTS) $(FOBJECTS)
#final compile of all .o files
$(TARGET): $(COBJECTS) $(FOBJECTS)
$(CC) $(COBJECTS) $(FOBJECTS) $(WARN) $(LIBS) -o $@
clean:
-rm -f *.o
Please first try with the provided CMake build file
Do I need to edit the CMakeLists.txt for my own project? I am new to using cmake.
Thanks
Well, first thing is to build with CMake following the instructions, make sure you can get the examples to build and run, then next step is to add into your own code. CMake is much superior to Makefiles since they are cross-platform
I think I got confused with what the purpose of REFPROP-headers is. I have a REFPROP license, using librefprop.so library (will be upgrading to the cmake build system soon). Since this repo is associated with CoolProp, should I not even be using this repo? Because I'm able to call a number of Refprop functions without using #include REFPROP_lib.h"
, but using #include "refprop_lib.h"
instead.
If so, then I will close this issue.
Well, librefprop.so is the historical way of building REFPROP on non-windows platforms. That has been since superceded by https://github.com/usnistgov/REFPROP-cmake
This library is used for calling REFPROP from C/C++, what was used in CoolProp initially. But it has no dependency on any other CoolProp things, by design. You can use static linking or dynamic linking with this header.
I understand. However, if I use #include "refprop_lib.h"
(I believe this came with librefprop.so), instead of #include "REFPROP_lib"
(the one that came with REFPROP-headers). I'm still able to make calls to REFPROP, for example TPRHOdll(<arguments>)
so, I may not even need to use this?
What is the difference between these two header files?
There are some additional functions (like the functions from REFPROP 10) in the REFPROP-headers one that are strongly advised to be used in general, unless speed is absolutely essential.
Hi, having a small issue using the REFPROP_lib.h header.
When compiling, I am getting errors saying that there are undefined references, to "WMOLdll" for example.
At the top of my C code, I am using
I am calling the functions like this:
XMASSdll(xmol, xkg, &molwt)
And getting this as my compilation output:Am I missing something?
Also, in the repo, there is no C example, only C++, would you consider adding that?
Thanks