Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Helping the indexer(Indexer is showing errors which are not in the compile output)
Helping the indexer [message #1716987] Wed, 09 December 2015 13:21 Go to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
Hello, the indexer is marking a lot of errors which are not a problem for the
compiling makefile.

The only info I get from eclipse is;

'string' is ambiguous '
Candidates are:
'

Added std to make it std::string, but that didn't help either.
If some variable is ambiguous, it should at least tell us, what are the
choices eclipse is having inside.

Right now, a lot of the source code is marked as an error, but it
shouldn't be like that.
A half year back in time (don't know exactly when) it didn't have any
errors. Compilers have changed, some new eclipse version, but right
now (and some months back) I don't know how to get rid of it.

Any advice?

Tnx Thomas
Re: Helping the indexer [message #1717028 is a reply to message #1716987] Wed, 09 December 2015 16:44 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
You need tell the indexer where the include files are.
Likely, you don't have the compiler buitin settings provider enabled.

Go to Project ==> C/C++ General ==> Preprocessor Include Paths, Macros, etc.
Select the Providers tab.
Make sure that the compiler Builtin Settings has been checked.

You should see a similar line in the Entries tab which you can expand to see the list of includes.

Re: Helping the indexer [message #1717042 is a reply to message #1717028] Wed, 09 December 2015 17:43 Go to previous messageGo to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
Tnx, but:

index.php/fa/24254/0/

It looks like the correct ones are checked:
- CDT User Setting Entries
- Exported Entries from Referenced Projects [ Shared ]
- CDT GCC Build Output Parser
- CDT GCC Buildin Compiler Settings [ Shared ]
- CDT Managed Build Setting Entries [ Shared ]

Re: Helping the indexer [message #1717061 is a reply to message #1717042] Wed, 09 December 2015 18:15 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
But you aren't getting any compiler settings.
The command displayed in the bottom pane of the Providers dialog is ..... ???

index.php/fa/24260/0/

What happens if you execute it in a command window?

Note: to get it to work outside of Eclipse you have to be compiling an empty source file.
no.cpp is an empty file.
You should get something similar.


[dvavra@fred ~]$ gcc -std=c++11 -E -P -v  -dD -c no.cpp
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-default-libstdcxx-abi=c++98 --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) 
COLLECT_GCC_OPTIONS='-std=c++11' '-E' '-P' '-v' '-dD' '-c' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/cc1plus -E -quiet -v -P -D_GNU_SOURCE no.cpp -mtune=generic -march=x86-64 -std=c++11 -dD
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/5.1.1/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1/backward
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/include
 /usr/local/include
 /usr/include
End of search list.
#define __STDC__ 1
#define __cplusplus 201103L
#define __STDC_UTF_16__ 1
#define __STDC_UTF_32__ 1
:
:
#define __STDC_ISO_10646__ 201304L
#define __STDC_NO_THREADS__ 1
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-std=c++11' '-E' '-P' '-v' '-dD' '-c' '-mtune=generic' '-march=x86-64'


You may be able to debug the discovery command by checking the Allocate console but it only allows this for a local command meaning you'd have to disable using a global one.. This is the command used:

g++ -std=c++0x -E -P -v -dD /home/dvavra/workspaces/workspace/.metadata/.plugins/org.eclipse.cdt.managedbuilder.core/spec.C

Which produces the same output.

Re: Helping the indexer [message #1717069 is a reply to message #1717061] Wed, 09 December 2015 19:15 Go to previous messageGo to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
I am getting about the same output.
g++ --version provides
g++ (Debian 5.3.1-3) 5.3.1 20151207

index.php/fa/24263/0/


As far as I can remember I have compiled everything again after debian unstable switched to new C++ Api.
Will need to look into that again tomorrow ...

compiling no.cpp gives:

Using built-in specs.
COLLECT_GCC=g++
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 5.3.1-3' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.3.1 20151207 (Debian 5.3.1-3)
COLLECT_GCC_OPTIONS='-E' '-P' '-v' '-dD' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -P -imultiarch x86_64-linux-gnu -D_GNU_SOURCE no.cpp -mtune=generic -march=x86-64 -std=c++11 -dD
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/5
/usr/include/x86_64-linux-gnu/c++/5
/usr/include/c++/5/backward
/usr/lib/gcc/x86_64-linux-gnu/5/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
#define __STDC__ 1
#define __cplusplus 201103L
Re: Helping the indexer [message #1717124 is a reply to message #1717069] Thu, 10 December 2015 07:10 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Well I don't know then.
You could try unchecking the box that selects the global provider and check the box below it to allocate a console view then you should see what Eclipse is actually seeing when it executes the command. Other than that I don't know what would cause it to not accept the output. It may be a bug that you've somehow triggered.


Edit:

My apologies. I take some of this back. I am confusing your post with another post that is having a superficially similar problem. For one, I said you aren't getting any builtin values but I just realized there was nothing in your post that indicated it.

Going back to your original, you had:

'string' is ambiguous '
Candidates are:
'


I get that myself sometimes. I can't tell you precisely why but I think you used string in a way that has more than one interpretation. The compiler may not care but the indexer might. The std::string class has a rather broad interface with coerced types. You may have encountered one of them. An example is string(string x) and string(char * x). The latter can be coerced to string(string). So, which constructor should be used? It's what the explicit keyword is supposed to help resolve.

Maybe we should back up and look at what you were seeing to begin with.
Start with the full error message and the lines of code associated with them.



[Updated on: Thu, 10 December 2015 07:37]

Report message to a moderator

Re: Helping the indexer [message #1717158 is a reply to message #1717124] Thu, 10 December 2015 10:55 Go to previous messageGo to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
What I have written is the complete error message.
I had expected to see more when I right-clicked on Properties
in the Problems tab.
Re: Helping the indexer [message #1718015 is a reply to message #1717158] Fri, 18 December 2015 15:09 Go to previous messageGo to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
I have tried to narrow down on the problematic code and it comes down to:

#include <iostream>
#include <string>

using namespace std;

#include <log4cxx/logger.h>

class TestCDT2
{
public:
TestCDT2();
virtual ~TestCDT2();

string testString;
};

As soon as I am including anything for log4cxx, the string is being flagged
as ambiguous.
The same code didn't have a problem with eclipse CDT sometime in the past.
Re: Helping the indexer [message #1718109 is a reply to message #1718015] Sat, 19 December 2015 18:43 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Right-click ==> Properties on a line in Problems view gets the properties for the marker. The error message is just text within the marker.

Quote:
As soon as I am including anything for log4cxx, the string is being flagged
as ambiguous.


Which should be a big clue. Why that changes things would be is anyone's guess. You don't seem to want to track this down yourself yet you aren't posting enough for anyone else to do so. It's not at all clear what you are looking for here. If you think it's a bug the submit it as one in Bugizlla where it has a chance of being fixed.
Re: Helping the indexer [message #1718716 is a reply to message #1718109] Tue, 29 December 2015 12:16 Go to previous messageGo to next message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
This is what I get, when I right-click in the problems view on the first error:
index.php/fa/24439/0/

So, it doesn't say what is bothering CDT, what string types cause the confusion.

Log4cxx is a logging library for C++, the code of the library is not soo simple.
I think, there might be other people using both tools.
Again, in the past this didn't raise any errors.

It seems, I have exhausted all ways at looking inside eclipse for causes of the error.
(I was hoping I had some config set up incorrectly and this could easily be fixed by
correcting the config.)

Currently all places where strings are used are marked as an error.
Will go to Bugzilla next.
Re: Helping the indexer [message #1721279 is a reply to message #1716987] Tue, 26 January 2016 10:01 Go to previous message
Thomas Mising name is currently offline Thomas Mising nameFriend
Messages: 9
Registered: January 2010
Junior Member
For filing a bug request, I need something small and reproducable.
I created a tiny new project, but the error didn't come up. So I compared the settings but couldn't find any differences.
If I could get the actual output from the CDT indexer, this would probably help.
https://aholzner.wordpress.com/2010/09/26/generating-c-index-files-for-eclipse-from-the-command-line-linux/
Can I trace the call for the CDT indexer and trigger that on the command line?
Previous Topic:Could not be resolved
Next Topic:Remote debugging Linux X11 application
Goto Forum:
  


Current Time: Thu Mar 28 21:57:05 GMT 2024

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

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

Back to the top