| Function can't be resolved error [message #1000196] |
Mon, 14 January 2013 03:39  |
David Vavra Messages: 6 Registered: October 2012 |
Junior Member |
|
|
I tried making a makefile project from existing code. When I edit, I constantly get errors indicating that the include files weren't recognized (such as: Function can't be resolved). So, I figured I'd make a corresponding Hello World project using the wizard to see the "right" way. I get the same problem from the very beginning.
There are no error flags on the include files so I assume they are being found. It just seems they aren't being considered.
Is there something special I need to do to make this work? I've tied searching for similar problems but only found non-applicable ones or those with no answers. This is very puzzling and I'd hate to have to convert what I have to individual projects.
DAV
#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts("Hello World!!!");
return EXIT_SUCCESS;
}
Description Resource Path Location Type
Function 'puts' could not be resolved Hello.cpp /Hello line 13 Semantic Error
[Updated on: Mon, 14 January 2013 03:45] Report message to a moderator
|
|
|
|
|
| Re: Function can't be resolved error [message #1000559 is a reply to message #1000517] |
Mon, 14 January 2013 20:45   |
John LaLuna Messages: 4 Registered: September 2011 |
Junior Member |
|
|
I'm having similar problems, but probably not for the same reasons.
Function 'Sleep' could not be resolved main.cpp /sfmltest line 22 Semantic Error
Invalid overload of 'endl' main.cpp /sfmltest line 21 Semantic Error
Method 'GetElapsedTime' could not be resolved main.cpp /sfmltest line 19 Semantic Error
Method 'GetElapsedTime' could not be resolved main.cpp /sfmltest line 21 Semantic Error
Type 'sf::Clock' could not be resolved main.cpp /sfmltest line 18 Semantic Error
#include <SFML/System.hpp>
#include <iostream>
//#include <iomanip>
using namespace std;
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
cout << Clock.GetElapsedTime() << endl;
sf::Sleep(0.5f);
}
return 0;
}
I'm attempting to configure SFML to work with Eclipse.
What's funny is that it does compile and link and I can run the executable from the Debug folder and it works exactly as it should, but I still get these errors, and in the editor it shows errors and red underlines in the code.
I've been using Eclipse CDT for the last 2 years at school, but this is the first time I've tried to use an external library.
[Updated on: Mon, 14 January 2013 20:46] Report message to a moderator
|
|
|
| Re: Function can't be resolved error [message #1000769 is a reply to message #1000559] |
Tue, 15 January 2013 07:09   |
Axel Mueller Messages: 1820 Registered: July 2009 |
Senior Member |
|
|
John LaLuna wrote on Tue, 15 January 2013 02:45I'm having similar problems, but probably not for the same reasons.
Function 'Sleep' could not be resolved main.cpp /sfmltest line 22 Semantic Error
Invalid overload of 'endl' main.cpp /sfmltest line 21 Semantic Error
Method 'GetElapsedTime' could not be resolved main.cpp /sfmltest line 19 Semantic Error
Method 'GetElapsedTime' could not be resolved main.cpp /sfmltest line 21 Semantic Error
Type 'sf::Clock' could not be resolved main.cpp /sfmltest line 18 Semantic Error
#include <SFML/System.hpp>
#include <iostream>
//#include <iomanip>
using namespace std;
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
cout << Clock.GetElapsedTime() << endl;
sf::Sleep(0.5f);
}
return 0;
}
I'm attempting to configure SFML to work with Eclipse.
What's funny is that it does compile and link and I can run the executable from the Debug folder and it works exactly as it should, but I still get these errors, and in the editor it shows errors and red underlines in the code.
I've been using Eclipse CDT for the last 2 years at school, but this is the first time I've tried to use an external library.
These are not build errors (from the compiler) but "semantic errors". The internal code analyzer (CODAN) creates them. CODAN depends on the CDT index that represents the structure of your source code with all declarations, definitions etc. (the index is used e.g. to get code completion, jump to to the declaration/definition with the key F3 etc.)
In your case it looks like the index is not complete. You should add the include paths for your external library to Project Properties->C/C++ general->Paths and Symbols and then rebuild the index (from the project's context menu).
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
|
|
|
| Re: Function can't be resolved error [message #1000897 is a reply to message #1000769] |
Tue, 15 January 2013 11:38   |
David Vavra Messages: 6 Registered: October 2012 |
Junior Member |
|
|
John is getting the same errors as I am. It also doesn't explain why the example I posted above exhibits similar problems. In my case, the includes are already in the include path.
I've attached a typical error and a snap of the includes list. I'm at a loss as to what else can be done.
BTW: notice the "/usr/local/unclude"? I had misspelled "include" when I added the path as you suggested. I subsequently edited the entry but now there's an entry I'm not allowed to delete.
UPDATE: The undeletable path was cute at first but it's beginning to be annoying. I can't compile because its not a valid path. I can't delete it because it's greyed out. It's not being kept in the .cproject file with the rest of the includes I've added yet I can export it. ARRGH! So, maybe the problem with the Code Analysis is because there are apparently multiple lists of include files (which IMO is not very good design)?
UPDATE2: Well, I found the phantom include in the g++ command lines contained in the *.sc and *_scd.mk files. After I edited those, the "unclude" disappeared. Something else to add to the test suite assuming there is one.
[Updated on: Tue, 15 January 2013 13:30] Report message to a moderator
|
|
|
|
| Re: Function can't be resolved error [message #1001037 is a reply to message #1000769] |
Tue, 15 January 2013 17:28  |
John LaLuna Messages: 4 Registered: September 2011 |
Junior Member |
|
|
Axel Mueller wrote on Tue, 15 January 2013 07:09These are not build errors (from the compiler) but "semantic errors". The internal code analyzer (CODAN) creates them. CODAN depends on the CDT index that represents the structure of your source code with all declarations, definitions etc. (the index is used e.g. to get code completion, jump to to the declaration/definition with the key F3 etc.)
In your case it looks like the index is not complete. You should add the include paths for your external library to Project Properties->C/C++ general->Paths and Symbols and then rebuild the index (from the project's context menu).
The path to the external library was already included, but I faux edited it and pressed Apply which resulted in a popup asking to rebuild the index. Once that was done the "semantic" errors went away. Curiously this resulted in another minor problem. lol. When I attempt to RUN the program it gets rebuilt and claims that the #includes no longer exist. "fatal error: SFML/Audio.hpp: No such file or directory main.cpp /sfmltest line 8 C/C++ Problem"
It's a minor problem that I can live with, but annoying. I can build it, and the executable does work as intended.
|
|
|
Powered by
FUDForum. Page generated in 0.03037 seconds