【发布时间】:2019-03-13 12:10:41
【问题描述】:
我一直在尝试使用 Veins 和 OMNET++ 配置 RInside,但发现了一些问题。
经过Is it possible to use RInside in omnet++/Veins project to benefit from rich R features和How to set up Eclipse + StatET + Rcpp on Windows的讨论后,我在omnet++中新建了一个项目(共享类型),并尝试配置RInside。我遇到了一些错误 ("undefined reference to RInside::operator[]", "undefined reference to RInside::parseEvalQ").
我知道这是一个链接错误。我对 C++ 配置和基于 Eclipse 的 IDE 相当陌生,因此很难找出问题所在。我还附上了配置的屏幕截图。如果有人可以提供帮助,我将不胜感激。
更新(在成功构建 RInside 并确保工具链正确之后)
这是makefrag文件
#
# on windows we have to link with the ws2_32 (winsock2) library as it is no longer added to the omnetpp system libraries by default (as of OMNeT++ 5.1)
# copied from INET Framework (inet-3.6.0) makefrag
#
ifeq ($(PLATFORM),win32.x86_64)
LIBS += -lws2_32
DEFINES += -DINET_EXPORT
ENABLE_AUTO_IMPORT=-Wl,--enable-auto-import
LDFLAGS := $(filter-out $(ENABLE_AUTO_IMPORT), $(LDFLAGS))
R_HOME := $(shell R RHOME | sed -e "s|\\\\|\/|g")
R_ARCH := --arch $(shell echo 'cat(.Platform$$r_arch)' | R --vanilla --slave)
sources := $(wildcard *.cpp)
programs := $(sources:.cpp=)
## include headers and libraries for R
RCPPFLAGS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config --cppflags)
RLDFLAGS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config --ldflags)
RBLAS := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config BLAS_LIBS)
RLAPACK := $(shell $(R_HOME)/bin/R $(R_ARCH) CMD config LAPACK_LIBS)
## include headers and libraries for Rcpp interface classes
RCPPINCL := $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
RCPPLIBS := $(shell echo 'Rcpp:::LdFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
## include headers and libraries for RInside embedding classes
RINSIDEINCL := $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
RINSIDELIBS := $(shell echo 'RInside:::LdFlags()' | $(R_HOME)/bin/R $(R_ARCH) --vanilla --slave)
#DEFINES += $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CPPFLAGS) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
#LIBS += $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)
endif
【问题讨论】:
-
我的建议是开始尝试构建(部分)提供的示例来验证您的本地工具链。如果可行,请尝试“移植”到 Eclipse、CMake、... 在过去的某个时候,贡献的 CMakefile 可以工作,但如果 a)它们都在 Windows 上工作,或者 b)它们是最新的,我不这样做。我使用标准的 R 工具...
-
OMNeT++ 模拟传统上是通过 opp_makemake 构建的,它创建 GNU Makefile。调整这些 Makefile 以使用自定义包含路径和库的一种简单方法是使用 makefrag 文件,该文件包含将插入到创建的 Makefile 中的代码片段。尝试构建 Veins,检查在 src/ 中创建的 Makefile,将其与 src/ 中的 makefrag 文件进行比较,并尝试从 RInside 的示例 Makefile 中获取代码,例如,github.com/eddelbuettel/rinside/blob/6699d52/inst/examples/…
-
感谢德克和克里斯托夫!非常感谢您的建议。我将围绕这些发布我的发现。