Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Smart pointer support
Smart pointer support [message #1778107] Sun, 10 December 2017 13:44 Go to next message
Michael Hept is currently offline Michael HeptFriend
Messages: 4
Registered: December 2017
Junior Member
When using smart pointers the eclipse internal analyser cannot resolve member fields.

index.php/fa/31536/0/

#include <memory>

struct thing {
	int size = 0;
};
class testclass {
	std::unique_ptr<thing> gui;
	thing* rawPtr;
public:
	testclass()
		: gui(new thing()), rawPtr(new thing())
	{

	}
	void doSth() {
		gui->size = 2;
		rawPtr->size = 2;
	}
};
int main(int argc, char* argv[]) {
	testclass a;
	a.doSth();
	return 0;
}


Compiles fine with
g++ -std=c++14 -O0 -g3 -Wall -c -fmessage-length=0 -o main.o "..\\main.cpp" 


But eclipse reports the following problem:
Field 'size' could not be resolved	main.cpp	/test	line 16	
Re: Smart pointer support [message #1778645 is a reply to message #1778107] Tue, 19 December 2017 10:03 Go to previous message
Michael Hept is currently offline Michael HeptFriend
Messages: 4
Registered: December 2017
Junior Member
I updated to eclipse oxygen and cdt 9.4 nightly and it works now :)
Previous Topic:Arduino 3.0 Plugin - corrupted makefiles?
Next Topic:problem with the rapidjson namespace
Goto Forum:
  


Current Time: Thu Jul 19 22:38:38 GMT 2018

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

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

Back to the top