Hello
I am trying just to create a vector object in my executable .cpp like this :
Ogre::Vector3 transVector = Ogre::Vector3::Vector3(1,1,1);
and getting following errors during the compilation.
error: cannot call constructor 'Ogre::Vector3::Vector3' directly [-fpermissive]
error: for a function-style cast, remove the redundant '::Vector3' [-fpermissive]
can you please tell me what is wrong there.
best
levan
[-fpermissive] ???
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: [-fpermissive] ???
Or even simpler:Ogre::Vector3 transVector = Ogre::Vector3(1,1,1);
Ogre::Vector3 transVector (1,1,1);
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: [-fpermissive] ???
Second option is better. The first one creates a temporary vector3 and then calls a copy constructor, which is unnecessary.
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: [-fpermissive] ???
The compiler will usually optimize that away. See Copy elision.
So use whatever you find easier to read.
So use whatever you find easier to read.
-
- Halfling
- Posts: 41
- Joined: Sun Oct 27, 2013 11:57 pm
- x 1
Re: [-fpermissive] ???
many thanks