cmmid / covid-uk

Scenario analyses for COVID-19 outbreak in the United Kingdom
GNU General Public License v3.0
64 stars 27 forks source link

RTools 4.0.0 on Windows 10 #6

Closed Koesters closed 4 years ago

Koesters commented 4 years ago

I can't yet get this to run on Windows 10 with RTools 4.0.0

On a VirtualBox Ubuntu 18 no problem:

The Ubuntu g++ call is

g++                          -std=gnu++11 
                                 -I"/usr/share/R/include" 
                 -DNDEBUG 
                                 -I/usr/include  
                 -I"/usr/local/lib/R/site-library/Rcpp/include" 
                 -I"/usr/local/lib/R/site-library/RcppGSL/include" 
                 -I"/home/user/covid-uk/covidm/fit_v1"    
                 -fpic  
                 -g 
                 -O2 
                 -fdebug-prefix-map=/build/r-base-aGvNeb/r-base-4.0.0=. 
                 -fstack-protector-strong 
                 -Wformat 
                 -Werror=format-security 
                 -Wdate-time 
                 -D_FORTIFY_SOURCE=2 
                 -g  
                 -c fit.cpp 
                 -o fit.o

Windows compiler options

`"C:/rtools40/mingw64/bin/"g++  
                 -std=gnu++11 
                 -I"C:/PROGRA~1/R/R-40~1.0/include" 
                 -DNDEBUG 
                 -I/include  
                 -I"C:/Users/user/R/win-library/4.0/Rcpp/include" 
                 -I"C:/Users/user/R/win-library/4.0/RcppGSL/include" 
                 -I"E:/name/covid/covid-uk/covidm/model_v1"        
                 -O2 
                 -Wall  
                 -mfpmath=sse 
                 -msse2 
                 -mstackrealign 
                 -c corona.cpp 
                 -o corona.o
`

The errors seem to all relate to namespace issues.

/covid-uk/covidm/model_v1/process.h:26:5: error: 'string' does not name a type; did you mean 'stdin'? etc etc

Do I enter namespace std in process.h it throws out covid-uk/covidm/model_v1/process.h:26:12: error: field 'source_name' has incomplete type 'std::cxx11::string' {aka 'std::cxx11::basic_string'}

Koesters commented 4 years ago

Process.h needs to look like this to compile under windows under RTools 4.0.0

#pragma once
#include <string>
#include <vector>
class Discrete;

enum SourceID
{
    srcS = 1000000,
    srcE,
    srcEp,
    srcEa,
    srcIp,
    srcIs,
    srcH,
    srcIa,
    srcI
};

const unsigned int Null = 999999;

struct ProcessSpec
{
    unsigned int source_id; // identifier for the compartment which, upon exiting, individuals enter this process
    std::string source_name;     // name of the above
    std::string type;            // ignored for now - multinomial or dirichlet multinomial

    std::vector<std::string> names;       // names of sub-processes
    std::vector<unsigned int> ids;   // identifiers of sub-process compartments
    std::vector<std::string> report;      // reporting mode of sub-processes: empty, "i", "o", "p", or a combination of these
    std::vector<std::vector<double>> prob;// probability by group of entering each sub-process from the source above; indexed by group then by subprocess
    std::vector<Discrete> delays;    // delays for each sub-process

    std::vector<unsigned int> p_cols;
    std::vector<unsigned int> p_ids;
    std::vector<unsigned int> i_cols;
    std::vector<unsigned int> i_ids;
    std::vector<unsigned int> o_cols;
    std::vector<unsigned int> o_ids;     // prevalence, incidence, and outcidence data columns and sub-process identifiers for this process
};