1
votes

I have a C++ project that is built using CMake. I want to build and run it in netbeans (8.2). I can import and build the project successfully, no problems there.

However, when I come to run it, I get a 'No executable specified in project' error. The popup invites me to navigate to the executable generated by CMake. When I navigate to the binary, it is not recognised by netbeans as an elf executable file. If I navigate to the file and do

file myExecutable

Linux reports it as ELF 64-bit LSB shared object, x86-64 etc...

I can run the executable from the command line so not problem there either.

Please help!

1

1 Answers

0
votes

Yes, for some reason the NetBeans 8.2 doesn't recognize the CMake-built executable files. One way to bypass this problem is:

  • Open the Project Properties popup window.
  • Click on Run button in the left pane to open run settings.
  • The Run Command setting is used to be the "${OUTPUT_PATH}" string. Replace this string by your relative executable name ./myExecutable.
  • Click OK to save properties.

This should do the trick.

UPDATE: I've just found out that adding compiler option -no-pie (do not create a position independent executable) allows the NetBeans to find executables correctly (at least in Ubuntu 18.04) - in this case you won't need any changes in the project properties.