开发者

Netbeans Remote C++ Development "No rule to make target" Error

开发者 https://www.devze.com 2023-04-12 19:37 出处:网络
When creating a simple 开发者_如何学JAVARemote C++ Development application in Netbeans, I get the following error:

When creating a simple 开发者_如何学JAVARemote C++ Development application in Netbeans, I get the following error:

gmake[2]: Entering directory '/path/to/project'
gmake[2]: *** No rule to make target '/path/to/project/cpp/file'
gmake[2]: Leaving directory '/path/to/project'

BUILD FAILED (exit value 2, total time: 1s)

To reproduce this error I simply create a new C/C++ Project, select a remote host that I have already configured. When I add a .ccp file with a corresponding .h file, I get this error. I don't even necessarily have to use or include those files with anything. It appears that Netbeans may not properly build the Makefile to represent the addition of those files to the project?


The problem is, I was using absolute paths for my project. Lesson learned, when developing remote projects using Netbeans, you can not use absolute paths unless the locations of the projects on both machines match exactly.

To configure Netbeans to use relative paths, click the "Tools" option in the menu bar and select "Options". Click the "C/C++" button at the top, and go to the "Project Options" tab. the second option, "File Path Mode:" needs to be set to "Always Relative". This will allow the Makefile to correctly find and compile the file.


Well, considering the output you must have added a file to the makefile (or Netbeans did) that isn't there where it is supposed to be. Therefore it thinks that it is a undeclared target, as targets, the actual target depends on, and the .cpp files the target depends on to compile, are in the same line. I would suggest that you make sure that the makefile is in the correct place and therefore if you follow the exact path you should end up where the file should be, or you configure the vpath variable to consider the directory where the file should be. Else this might give further help as the error message does sound quite the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号