Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Indexer not working with << operator (Indexer not working with << operator )
Indexer not working with << operator [message #997311] Sat, 05 January 2013 15:26 Go to next message
Andrew Ragone is currently offline Andrew Ragone
Messages: 4
Registered: January 2013
Junior Member
I'm working on Juno, with MinGW as the tool chain and Makefile project. I am also having this issue on a Linux box with Indigo. The code.jpg is a screen shot of my problem.

As you can see the endl is being picked up by the parser as an error. However everything compiles and executes without issues. I've tried the following:


  • Window->Preferences->Indexer.
  • Increase Cache Limits to 256 MB.
  • "Use active build configuration"
  • Rebuilding Index: Uncheck "Enable Indexer". Click Apply. Check "Enable Indexer". Click OK
  • Right Click Project -> Indexer -> Tried many options combinations.


includes.jpg is a screen shot of my includes. Should I add anything to my Includes?

Anything other than put a semi colon after the variable and have a cout << endl; as the next statement would be greatly appreciated.

Thanks in advance,

Andrew
  • Attachment: code.jpg
    (Size: 93.23KB, Downloaded 77 times)
  • Attachment: includes.jpg
    (Size: 50.27KB, Downloaded 74 times)
Re: Indexer not working with << operator [message #997524 is a reply to message #997311] Tue, 08 January 2013 02:16 Go to previous messageGo to next message
Andrew Ragone is currently offline Andrew Ragone
Messages: 4
Registered: January 2013
Junior Member
Does anyone else have this problem? This is the code you can copy and paste into eclipse:

#include <string>
#include <boost/units/systems/si/time.hpp>
#include <boost/units/systems/si/io.hpp>

using namespace std;
using namespace boost::units;
using namespace boost::units::si;

int main(void)
{
	quantity<si::time, double> myseconds = 10 * seconds;

	//indexer does NOT like this endl
	cout << myseconds << endl;

	string mystring = "No 'error' here";
	cout << mystring << endl;

	return 0;
}





Please Help!

Thanks,

Andrew
Re: Indexer not working with << operator [message #997576 is a reply to message #997524] Tue, 08 January 2013 12:41 Go to previous messageGo to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
Where can I find the .hpp files you have included? I am still a beginner in C++. Can you tell me if mySeconds is converted to string automatically so that it can be used in cout statement?

Edit:

I think you cannot use mySeconds with cout. You have to pass a string to cout.

[Updated on: Tue, 08 January 2013 13:00]

Report message to a moderator

Re: Indexer not working with << operator [message #997876 is a reply to message #997576] Tue, 08 January 2013 23:06 Go to previous messageGo to next message
Andrew Ragone is currently offline Andrew Ragone
Messages: 4
Registered: January 2013
Junior Member
Thx for the reply. You can download the boost API here: www dot boost dot org . It has many useful APIs that are not in stl. After you download and extract, just copy the boost directory into your include directory as it's a header only library. i.e. it has no binaries (for most of the APIs at least).

mySeconds is using boost's units template library. It overloads the << operator so you do not have to do any type conversions (which is an expensive operation). You can read about templates here: www dot cplusplus dot com/doc/tutorial/templates/ . This website is very good resource if you are new C++. if you have any issues installing the boost library let me know and I'll help you out. If you can confirm you have this issue also it will be great. I can file a bug report. What tool chain/compiler are are you using?

p.s. Sorry about the links. I'm getting an error with this forum saying that i can only post links to eclipse.org

[Updated on: Tue, 08 January 2013 23:08]

Report message to a moderator

Re: Indexer not working with << operator [message #998036 is a reply to message #997876] Wed, 09 January 2013 08:43 Go to previous messageGo to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
OK. I will reply you again after I download and install the boost API. I am using I am using Eclipse C/C++ IDE and MinGW Compiler tools.

Edit:

I tried to compile the code after succesfully installing boost library and got the same error you are getting i.e., "invalid overload of endl"

I think myseconds is not being converted to string.

[Updated on: Wed, 09 January 2013 09:35]

Report message to a moderator

Re: Indexer not working with << operator [message #998083 is a reply to message #997876] Wed, 09 January 2013 10:43 Go to previous messageGo to next message
Jayanth D is currently offline Jayanth D
Messages: 16
Registered: December 2012
Junior Member
Hi!

This code compiles fine.

#include <string>
#include <boost/units/systems/si/time.hpp>
#include <boost/units/systems/si/io.hpp>

using namespace std;
using namespace boost::units;
using namespace boost::units::si;

int main(void)
{
	quantity<si::time, double> myseconds = 10 * seconds;

	//indexer does NOT like this endl
	cout << myseconds;
	cout << endl;

	string mystring = "No 'error' here";
	cout << mystring << endl;

	return 0;
}
Re: Indexer not working with << operator [message #998415 is a reply to message #998083] Wed, 09 January 2013 23:44 Go to previous message
Andrew Ragone is currently offline Andrew Ragone
Messages: 4
Registered: January 2013
Junior Member
You were not able to compile the code i posted with "cout << myseconds << endl;"? Instead of compiling it from eclipse, can you try to run this from your terminal or command prompt:

g++ filename.cpp -g -Wall -fmessage-length=0 -o output.exe

The code i posted compiles on both linux and windows on my end.

thx again for the help
Previous Topic:Problems with Photran
Next Topic:pthread_t error after including paths
Goto Forum:
  


Current Time: Thu Oct 30 18:29:47 GMT 2014

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

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