Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » resolve symbolic links / linux(want to have symbolic links e.g. inside gcc output to be resolved)
resolve symbolic links / linux [message #1758181] Fri, 24 March 2017 11:32 Go to next message
Michael Schwinne is currently offline Michael SchwinneFriend
Messages: 2
Registered: March 2017
Junior Member
Dear all,

I'm using eclipse for the development of a shared library which is used by a 3rd party commercial software. This software already creates the required makefile.
My problem is that the software is creating symbolic links of my .c and .h files to a build-folder.
I'm able to build from eclipse but if there is an error in one of the files, the error is of course reported for the symbolic link of my c-file and not fot the original file - so if I open the error message I will get a new editor for the symbolic link.

Is there any possibility to force eclipse to always resolve symbolic links (like with readlink -m) when opening a file for editing?

Thanks in advance and best regards,

Michael
Re: resolve symbolic links / linux [message #1758238 is a reply to message #1758181] Sat, 25 March 2017 14:35 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Symlinks are automatically deferenced in linux.
It's not clear where your links are in the build directory.
When gcc (or one of its derivatives) reports an error, the file name in the error is relative to the cwd of the compile.
Since the file being compiled is really a link, the path of the link is given.

For example, the normal CDT lyout for a managed build for configuration Debug is
project/src/
project/Debug

When a build is done the make working directory is project/Debug.
So a compile with an error looks like the following (the macro ERROR causes an error)
$ g++ -DERROR -c ../src/Hello.cpp
../src/Hello.cpp:11:2: error: #error "an error"
 #error "an error"
  ^~~~~

I placed a link to Hello.cpp in project/Debug/src then tried to compile it
$ ln ../../src/Hello.cpp Hello.cpp
$ cd ..
$ g++ -DERROR -c src/Hello.cpp
src/Hello.cpp:11:2: error: #error "an error"
 #error "an error"
  ^~~~~


Note the different file specifications in the error messages.
They would not be the same file to Eclipse.
Opening either should get you to the same file but Eclipse could have both open.
This is desirable as you might want to have two versions of a file open simultaneously.

The only way around this is to have the source path specification the same as that expected by CDT.
Re: resolve symbolic links / linux [message #1758249 is a reply to message #1758238] Sat, 25 March 2017 20:20 Go to previous message
Michael Schwinne is currently offline Michael SchwinneFriend
Messages: 2
Registered: March 2017
Junior Member
Hi David,

thanks a lot for your reply.
In my case the errors are reported by gcc with the full path in the terminal but Eclipse is showing the error for the local symbolic link. By the way semantic errors are handled correctly - Eclipse is showing the error for the original file and not for the symbolic link. Eclipse is getting the information by using some Java regular expressions - I will take a look at this on Monday, maybe I find a way by chaning the expressions in the build settings.

Best regards,

Michael
Previous Topic:Use unidata netcdf libraries
Next Topic:Build settings restore defaults : what about project settings ?
Goto Forum:
  


Current Time: Sat Apr 27 01:48:46 GMT 2024

Powered by FUDForum. Page generated in 0.03287 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top