7

When creating a simple Remote 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?

ossys
  • 4,157
  • 5
  • 32
  • 35
  • I get that error message when a symlink is broken. – spraff Oct 11 '11 at 17:44
  • Filename in directory was changed subtly; new filename included, but old filename still in roster, even though file no longer there. Delete old filename from roster. – DragonLord Dec 23 '20 at 18:41

2 Answers2

9

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.

ossys
  • 4,157
  • 5
  • 32
  • 35
  • 1
    Hi, I did the same but I still see the same error: `gmake[2]: *** No rule to make target bla/bla/bla/XXX.cpp needed by build/Debug/GNU-Linux-x86/_ext/501894549/XXX.o` And I checked and couldn't find the specified directory. What can be the problem? – Cihad Turhan Apr 18 '12 at 14:30
2

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.

Community
  • 1
  • 1
Sim
  • 4,199
  • 4
  • 39
  • 77
  • I looked into this a little further. Since the project is a remote project, Netbeans was not putting the correct path in the Makefile for the newly created .cpp file. For example, the file was located on my windows machine (dev machine) on C:\dev\CPP\Project\test.cpp... however the Makefile (to be built on a remote linux machine) had /C/dev/CPP/Project/test.cpp, which is not the full path to the file. – ossys Oct 11 '11 at 19:19