找回密码
 立即注册
收起左侧

qt在windows下编译出错

0
回复
7526
查看
[复制链接]
累计签到:3 天
连续签到:1 天
来源: 2017-3-20 14:38:40 显示全部楼层 |阅读模式
1Qter豆
本帖最后由 xzhyj93 于 2017-3-20 14:45 编辑

之前在linux上跑得好好的一个项目放到windows上一直报错,关键在于引入了R语言的一个包RInside的原因,但是不知道如何修正?
我试了官方的示例仍然会报错,主要错误一个是deplicate section....和undefined reference to RInside::xxxx
请问这个问题要怎么解决呢?

这是错误信息:
14:41:38: Running steps for project qtdensity...
14:41:38: Configuration unchanged, skipping qmake step.
14:41:38: Starting: "D:\Programs\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
D:/Programs/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'D:/Downloads/DownloadsPrograms/build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug'
g++ -Wl,-subsystem,windows -mthreads -o debug/qtdensity.exe debug/qtdensity.o debug/main.o debug/moc_qtdensity.o  -LD:/Programs/R/R-3.3.1/bin/i386 -lR -lm -lRblas -lRlapack D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a -lmingw32 -LD:/Programs/Qt/5.7/mingw53_32/lib D:/Programs/Qt/5.7/mingw53_32/lib/libqtmaind.a -lshell32 D:/Programs/Qt/5.7/mingw53_32/lib/libQt5Cored.a -LC:/utils/my_sql/my_sql/lib -LC:/utils/postgresql/pgsql/lib D:/Programs/Qt/5.7/mingw53_32/lib/libQt5Svgd.a D:/Programs/Qt/5.7/mingw53_32/lib/libQt5Widgetsd.a D:/Programs/Qt/5.7/mingw53_32/lib/libQt5Guid.a D:/Programs/Qt/5.7/mingw53_32/lib/libQt5Cored.a
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp9exceptionE[__ZTVN4Rcpp9exceptionE]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp15no_such_bindingE[__ZTVN4Rcpp15no_such_bindingE]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp17binding_is_lockedE[__ZTVN4Rcpp17binding_is_lockedE]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp10eval_errorE[__ZTVN4Rcpp10eval_errorE]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTCN4Rcpp8RostreamILb1EEE0_So[__ZTCN4Rcpp8RostreamILb1EEE0_So]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp8RostreamILb1EEE[__ZTVN4Rcpp8RostreamILb1EEE]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTCN4Rcpp8RostreamILb0EEE0_So[__ZTCN4Rcpp8RostreamILb0EEE0_So]' has different size
D:/Programs/R/R-3.3.1/library/RInside/lib/i386/libRInside.a(RInside.o): duplicate section `.rdata$_ZTVN4Rcpp8RostreamILb0EEE[__ZTVN4Rcpp8RostreamILb0EEE]' has different size
debug/qtdensity.o: In function `ZN9QtDensityC2ER7RInside':
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:15: undefined reference to `RInside:perator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:16: undefined reference to `RInside::parseEval(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:17: undefined reference to `RInside::parseEval(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
debug/qtdensity.o: In function `ZN9QtDensity4plotEv':
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:96: undefined reference to `RInside:perator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:97: undefined reference to `RInside:perator[](std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:102: undefined reference to `RInside::parseEvalQ(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
debug/qtdensity.o: In function `ZN9QtDensity16runRandomDataCmdEv':
D:\Downloads\DownloadsPrograms\build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug/../../../qt/qtdensity.cpp:127: undefined reference to `RInside::parseEvalQNT(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [debug/qtdensity.exe] Error 1
mingw32-make: *** [debug] Error 2
Makefile.Debug:65: recipe for target 'debug/qtdensity.exe' failed
mingw32-make[1]: Leaving directory 'D:/Downloads/DownloadsPrograms/build-qtdensity-Desktop_Qt_5_7_0_MinGW_32bit-Debug'
Makefile:34: recipe for target 'debug' failed
14:41:40: The process "D:\Programs\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project qtdensity (kit: Desktop Qt 5.7.1 MinGW 32bit)
The kit Desktop Qt 5.7.1 MinGW 32bit has configuration issues which might be the root cause for this problem.
When executing step "Make"
14:41:40: Elapsed time: 00:01.


下面是.pro文件
  1. ## build an app based on the one headers and two source files
  2. TEMPLATE =                 app
  3. HEADERS =                qtdensity.h
  4. SOURCES =                 qtdensity.cpp main.cpp

  5. ## beyond the default configuration, also use SVG graphics
  6. QT +=                         svg

  7. ## comment this out if you need a different version of R,
  8. ## and set set R_HOME accordingly as an environment variable
  9. R_HOME =                 $system(R RHOME)
  10. #message("R_HOME is" $R_HOME)

  11. ## include headers and libraries for R
  12. RCPPFLAGS =                 $system($R_HOME/bin/R CMD config --cppflags)
  13. RLDFLAGS =                 $system($R_HOME/bin/R CMD config --ldflags)
  14. RBLAS =                 $system($R_HOME/bin/R CMD config BLAS_LIBS)
  15. RLAPACK =                 $system($R_HOME/bin/R CMD config LAPACK_LIBS)

  16. ## if you need to set an rpath to R itself, also uncomment
  17. RRPATH =                -Wl,-rpath,$R_HOME/lib

  18. ## include headers and libraries for Rcpp interface classes
  19. ## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
  20. RCPPINCL =                 $system($R_HOME/bin/Rscript -e "Rcpp:::CxxFlags\(\)")
  21. RCPPLIBS =                 $system($R_HOME/bin/Rscript -e "Rcpp:::LdFlags\(\)")

  22. ## for some reason when building with Qt we get this each time
  23. ##   /usr/local/lib/R/site-library/Rcpp/include/Rcpp/module/Module_generated_ctor_signature.h:25: warning: unused parameter ‘classname
  24. ## so we turn unused parameter warnings off
  25. ## no longer needed with Rcpp 0.9.3 or later
  26. #RCPPWARNING =                -Wno-unused-parameter

  27. ## include headers and libraries for RInside embedding classes
  28. RINSIDEINCL =                 $system($R_HOME/bin/Rscript -e "RInside:::CxxFlags\(\)")
  29. RINSIDELIBS =                 $system($R_HOME/bin/Rscript -e "RInside:::LdFlags\(\)")

  30. ## compiler etc settings used in default make rules
  31. QMAKE_CXXFLAGS +=        $RCPPWARNING $RCPPFLAGS $RCPPINCL $RINSIDEINCL
  32. QMAKE_LIBS +=           $RLDFLAGS $RBLAS $RLAPACK $RINSIDELIBS $RCPPLIBS

  33. ## addition clean targets
  34. QMAKE_CLEAN +=                qtdensity Makefile
复制代码


附件: 您需要 登录 才可以下载或查看,没有帐号?立即注册
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了