<solved>Compiling 1.0.5 with Code::Blocks and gcc

kiolakin

30-11-2005 16:32:46

I have finally found that Code::Blocks and gcc seem to be the best combination to use with ogre since you can compile multithreaded DLLs and thereby compile the entire 1.0.6 ogre package.

Now I am trying to get 1.0.5 paging landscape to compile along with it. At first there were a few assignments that gcc wanted clarification on, but having put in explicit type conversions, it seems to be ok. There were also a few function prototypes missing. It seems that 3 of the 4 missing prototypes from PagingLandScapeOctree where actually supposed to be declared pure virtual in its base class but then for some reason were commented out. For simplicity in compiling, I added these prototypes directly to the PagingLandScapeOctree. There was a 4th function that had no prototype to speak of anywhere, so I added it as well.

My hopes for this were to send a fully compiling version back to the author for Code::Blocks and gcc since the few additions of clarifying assignment typing and adding prototypes shouldn't mess up the main line compile on VC++.

I found early on that the occlusion culling was not in the existing Code::Blocks project so I added the files. Now there seems to be some sort of stl error that may be a bit over my understanding. Do I need a newer version of gcc? Is there a newer stl for gcc that I need ?

Error:

:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h: In function `void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Ogre::OcclusionElement**, std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> > >, _Distance = int, _Tp = Ogre::OcclusionElement*, _Compare = Ogre::FrontToBackNodeSorterOperator]':
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h:404: instantiated from `void std::make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Ogre::OcclusionElement**, std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> > >, _Compare = Ogre::FrontToBackNodeSorterOperator]'
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_queue.h:369: instantiated from `std::priority_queue<_Tp, _Sequence, _Compare>::priority_queue(const _Compare&, const _Sequence&) [with _Tp = Ogre::OcclusionElement*, _Sequence = std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> >, _Compare = Ogre::FrontToBackNodeSorterOperator]'
..\src\OgrePagingLandScapeOcclusion.cpp:216: instantiated from here
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h:279: error: no match for call to `(Ogre::FrontToBackNodeSorterOperator) (Ogre::OcclusionElement*&, Ogre::OcclusionElement*&)'
../include/OgrePagingLandScapeOcclusionSorter.h:17: note: candidates are: bool Ogre::FrontToBackNodeSorterOperator::operator()(const Ogre::OcclusionElement*&, const Ogre::OcclusionElement*&) const
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h: In function `void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Ogre::OcclusionElement**, std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> > >, _Distance = int, _Tp = Ogre::OcclusionElement*, _Compare = Ogre::FrontToBackNodeSorterOperator]':
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h:203: instantiated from `void std::push_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Ogre::OcclusionElement**, std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> > >, _Compare = Ogre::FrontToBackNodeSorterOperator]'
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_queue.h:432: instantiated from `void std::priority_queue<_Tp, _Sequence, _Compare>::push(const typename _Sequence::value_type&) [with _Tp = Ogre::OcclusionElement*, _Sequence = std::vector<Ogre::OcclusionElement*, std::allocator<Ogre::OcclusionElement*> >, _Compare = Ogre::FrontToBackNodeSorterOperator]'
..\src\OgrePagingLandScapeOcclusion.cpp:224: instantiated from here
C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_heap.h:166: error: no match for call to `(Ogre::FrontToBackNodeSorterOperator) (Ogre::OcclusionElement*&, Ogre::OcclusionElement*&)'
../include/OgrePagingLandScapeOcclusionSorter.h:17: note: candidates are: bool Ogre::FrontToBackNodeSorterOperator::operator()(const Ogre::OcclusionElement*&, const Ogre::OcclusionElement*&) const

kiolakin

30-11-2005 19:48:08

Ok I understand a little more about what is going on. The template priority_queue is not understanding that when it states: FrontToBackNodeSorterOperator(const OcclusionElement*& a, const OcclusionElement*& b) , that we actually want it to grab:
inline bool operator()(const OcclusionElement*& a, const OcclusionElement*& b) const

It seems the simple fix to this would be to duplicate this operator as a function named Compare(,) or whatever, but I want to know is this going to be something where I have to change this stuff every time I download another copy or an updated version of PLSM2 or can I get this change made in the main tree ?

kiolakin

30-11-2005 20:52:52

Well, that won't work. Anyone know offhand how to get it to recognize that we are looking for the boolean comparison. I am not that familiar with priority_queue.

kiolakin

01-12-2005 02:46:00

Looks like I finally found a post where someone was having a similar problem. I'll just note it here for anyone who comes along my post looking for a solution.

http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=57

I have to redownload and start over at home to try this since I was messing with all of this at work today.

kiolakin

01-12-2005 05:12:43

Now that I have a version that works with Code::Blocks/gcc can I zip it up and send it in for you guys to put on the website?

I don't have a copy of VC++ here anymore, but I am fairly sure that it will compile there just as well.

Princess_Conecloon

03-12-2005 03:03:25

I have also been trying to get PLSM to compile using Code::Blocks / gcc, it would be great if you could zip it up and find a way to get it on the site! :D

tuan kuranes

03-12-2005 12:47:25

send me the zip.
(email is on profile)
SDK or CVS ?

kiolakin

03-12-2005 22:08:18

SDK, sorry I haven't checked this thread since I got it working.

The zip is 59 MB, maybe I can clean out the executables a bit more and get it down. Ill send it to you later today.