简体   繁体   中英

nloptr version 1.2.1 installation on Window 10: error #include "nlopt.h"

I need to install nloptr version 1.2.1 on Windows 10. Here is my code:

library("devtools")
install_version("nloptr", version = "1.2.1", repos = "http://cran.us.r-project.org")

And here is extract of error message:

init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
 #include "nlopt.h"
          ^~~~~~~~~
compilation terminated.

Any work around?

In fact, when installing {nloptr} from source on Windows OS, 'NLopt' is required. See the description from its github source :

For this to work on Windows, you need to have Rtools and NLopt installed, and set an environment variable NLOPT_HOME with the location of the NLopt library.

This can be done through RTools. Just open "Rtools Bash" program and execute these lines:

pacman -Sy
pacman -S mingw-w64-{i686,x86_64}-nlopt

Note: pacman -Sy is required only for refreshing Rtools packages for the first time use of "pacman".

For more information, see the official instructions of pacman .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM