简体   繁体   中英

Maven cannot run program “link”

I am trying to build a simple C++ project with maven and the nar-maven-plugin, but I'm getting the following error:

Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.2.3:nar-validate (default-nar-validate) on project it0015-cpp-executable: Could not launch cmd.exe /X /C "link /?": Error while executing process. Cannot run program "link": CreateProcess error=2, The system cannot find the file specified -> [Help 1]

I am using Windows 8.1. Does anyone have ideas on how to investigate this issue?

you should specify the linker you are using.

For me, i'm using MinGW so i update my user path (environment variable) with C:/MinGW/bin and in the nar-maven-plugin i specify the linker name to g++

  <plugin>
    <groupId>com.github.maven-nar</groupId>
    <artifactId>nar-maven-plugin</artifactId>
    <version>3.2.3</version>
    <extensions>true</extensions>
    <configuration>
      <linker>
        <name>g++</name>
      </linker>
      <libraries>
        <library>
          <type>executable</type>
        </library>
      </libraries>
    </configuration>
  </plugin>

Now you can launch "mvn validate" to check if it works

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