开发者

Eclipse, "cannot create a link to [dir]"? Generated by cmake

I'm getting a strange error in Eclipse when importing a project generated by cmake 2.8.5 ("Eclipse - Unix Makefile", also with "Eclipse - MingW Makefile"):

Error processing changed links in project description file. Cannot create a link to '[project_dir]' because it 开发者_如何学Coverlaps the location of the project that contains the linked resource.

with [project_dir] the path of the root folder of my project. I'm on Windows 7, Java 7, Eclipse 3.7, all 64 Bit.

What exactly does this message mean? And how do I fix it? The only thing it seems to be causing is that Eclipse isn't able to resolve some include path (it's annyoing to have "errors" that are no errors in the code window), compiling with MingW is working perfectly fine however...

This seems also to produce a strange empty "[Subolders]" folder in the Eclipse folder view... (No idea what this is for)

I did set up this project several times already, but never got this message...

Any ideas? Thanks.


I have seen Eclipse produce that message if the generated Eclipse project is in an out-of-source CMake build folder that is located inside the project folder, i.e.:

cd project_dir
mkdir build
cd build
cmake -G "Eclipse - Unix Makefile" ..

As a work-around generate an in-source CMake build or generate the build folder next to the project folder, i.e.:

mkdir build
cd build
cmake -G "Eclipse - Unix Makefile" ../project_dir


Out-of-source builds generally work fine with CMake and Eclipse as of ~CMake 2.8 or so. But I just saw the exact error message you mention in the case where my top-level CMakeLists.txt file contains this:

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})

If I remove that line, the error goes away. (This feels like a bug, but I haven't gotten round to reporting it, or confirming whether it's expected behavior...)


Solved; I followed sakra's solution but was not enough. I added into my CMakeLists.txt the following lines

set(PROJECT_SOURCE_DIR <somewhere>/workspace/project)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR})

And called, outside project directory, CMake:

cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug <path_to_project>

Then imported as said before. Note that error is still signalled, but everything works, except for the Build tool (pickaxe button) which doesn't work because there are no Build Configurations, but just targets, as those showed in the following screenshot.

Eclipse, "cannot create a link to [dir]"? Generated by cmake

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜