Simon,

I'm not a C++ expert, but I think there are two issues:
1) you cannot inline virtual methods so you have to remove "inline"
2) you have to bring in the definition of the method that you want to override 
if it is intentional

so just to fix ParStudentInd.* you need

diff --git a/src/ParStudentInd.cpp b/src/ParStudentInd.cpp
index d944440..f8b9596 100644
--- a/src/ParStudentInd.cpp
+++ b/src/ParStudentInd.cpp
@@ -12,7 +12,6 @@ ParStudentInd::ParStudentInd (const bool& STARTPAR,
    }
 }
 
-inline
 void ParStudentInd::update(const PriorStudentInd& hyperPar)
 {
    weight = rdirichlet(hyperPar.weightPost);
diff --git a/src/ParStudentInd.h b/src/ParStudentInd.h
index c7efd45..45b9717 100644
--- a/src/ParStudentInd.h
+++ b/src/ParStudentInd.h
@@ -27,6 +27,7 @@ ParStudentInd (const bool&,
 virtual ~ParStudentInd ()
 {
 }
+using ParStudentFix::update;
 virtual void update(const PriorStudentInd&);
 };
 #endif /* __FINMIX_PARSTUDENTIND_H__ */


The same will be needed for all the classes. I don't know if it's all, but it's 
at least one of the issues ;).

Cheers,
Simon



> On Nov 8, 2021, at 11:36 PM, Simon Zehnder <simon.zehn...@googlemail.com> 
> wrote:
> 
> Hi Simon, 
> 
> thank you for bringing this up. As mentioned in the answer to Dirk, I am at 
> this point not anymore that fluent in C++ as I was some years ago. I am 
> looking through the classes and I am not yet sure what to look for. What I 
> see is an error message: 
> 
> ./PriorStudentInd.h:31:14: warning: 'PriorStudentInd::update' hides 
> overloaded virtual function [-Woverloaded-virtual]
> 
> When I look into the class definition I see: 
> 
> #ifndef __FINMIX_PARSTUDENTIND_H__
> #define __FINMIX_PARSTUDENTIND_H__
> 
> #include "ParStudentFix.h"
> #include "PriorStudentInd.h"
> 
> class ParStudentInd : virtual public ParStudentFix {
> public:
> arma::rowvec weight;
> 
> ParStudentInd (const bool&,
>                const FinmixModel&);
> virtual ~ParStudentInd ()
> {
> }
> virtual void update(const PriorStudentInd&);
> };
> #endif /* __FINMIX_PARSTUDENTIND_H__ */
> 
> Can you give me a hint, what might be the reason here. I have an intuition 
> that it is due to either the "virtual" class inheritance or/and the "virtual" 
> method definition that now includes a different parameter (PriodStudentInd 
> instead of PriorStudentFix). 
> 
> Best,
> Simon
> 
> 
> Am So., 7. Nov. 2021 um 22:22 Uhr schrieb Simon Urbanek 
> <simon.urba...@r-project.org>:
> Simon,
> 
> this is not a build issue, it breaks on all platforms in clang (tested on 
> macOS and Debian+clang-11). There are tons of warnings in the C++ code (way 
> over 1000 lines!) which lead to an error at link time (most of them are type 
> mismatches leading to overrides of virtual methods). The particular one you 
> see:
> 
> $ for i in `ls *.o`; do nm $i | sed "s:^:$i:" | grep __ZT.13ParStudentInd; 
> done
> ParStudentInd.o0000000000001820 S __ZTI13ParStudentInd
> ParStudentInd.o0000000000001b50 S __ZTS13ParStudentInd
> ParStudentInd.o00000000000017a0 S __ZTV13ParStudentInd
> mcmc_student.o                 U __ZTT13ParStudentInd
> 
> So mcmc_student expects a VTT, but there is none defined in the 
> implementation (ParStudentInd). To make it clear pass it thought de-mangler 
> like llvm-cxxfilt:
> 
> ParStudentInd.o: 0000000000001820 S typeinfo for ParStudentInd
> ParStudentInd.o: 0000000000001b50 S typeinfo name for ParStudentInd
> ParStudentInd.o: 00000000000017a0 S vtable for ParStudentInd
> mcmc_student.o:                  U VTT for ParStudentInd
> 
> The above is just one of many link errors (pretty much all classes are 
> mismatched in the mcmc_*.cpp files).
> 
> Cheers,
> Simon
> 
> 
> 
> > On Nov 8, 2021, at 4:56 AM, Dirk Eddelbuettel <e...@debian.org> wrote:
> > 
> > 
> > Simon,
> > 
> > Your Makevars [1] is very standard so I would suspect it may be the actions
> > setup for macOS.  Rcpp is still used by a large number of packages all of
> > which appear to build just fine on macOS (as eg evidenced by the CRAN 
> > checks)
> > if and when everything is setup correctly.
> > 
> > Dirk
> > 
> > [1] https://github.com/simonsays1980/finmix/blob/documentation/src/Makevars
> > 
> > -- 
> > https://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org
> > _______________________________________________
> > Rcpp-devel mailing list
> > Rcpp-devel@lists.r-forge.r-project.org
> > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
> 

_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to