jeudi 26 décembre 2019

Tag dispatching to remove operators

I want to be able to use compile time information to prevent two objects of the same class being combined. In particular if a represents meters, and b uses centimeters I want the compiler to not allow their combination.

I think something like this should be possible with tags, but am slightly at a loss for how. I'm using the example of doubles here, but really the base type is more complicated, and I want to avoid having to redefine every single operator as there are enormous number. I want the class to behave exactly like the original class when interacting with other members of its tagged-class, but refuse the same operations if the tags don't match.

Something like this?

struct Meters{};
struct Centimeters{};

template < struct Units >
class DimensionedDouble : public double {
 // magic
}

int main(){
 DimensionedDouble<Meters> a(0.0), b(1.0);
 DimensionedDouble<Centimeters> c(2.0);

 std::cout << a+b << std::endl; // fine
 std::cout << a+c << std::endl; // compile error!

 return 1;
}

C++ Multithreading Problem about Cell Culture

I am new to multithreading so any suggestions will be very useful! I am implementing a multithreading program according to the following requirements:

  • The user inputs a list of integers as a vector. Each vector element N represents a cell.
  • The vector elements are passed to a threading function, from which the total cells at a certain time are calculated
  • The lifetime of the cells ( 0.1 + N % 8 seconds) is calculated. At half their lifetime, they breed a number (( N – N % 8 ) / 8 ) of child cells.
  • The child cells live the same amount as their parents, but die without breeding when their lifetime is over.
  • A cell monitor is started before the first genesis cell thread is created. The monitor will print out the number of existing live cells every second, so as to monitor how many cells are live.
  • A main function awaits input from user. vector inputs are given, it will start the monitor thread and then start the genesis cells threads.

From the above rules, this is the expected output:

[Main] Please input a list of gene seeds:
1 2 3 4 5 6 7
[Monitor] Started [ 0 s ]
[Monitor] Total Cells: 7 [ 1 s ]
[Monitor] Total Cells: 6 [ 2 s ]
[Monitor] Total Cells: 5 [ 3 s ]
[Monitor] Total Cells: 4 [ 4 s ]
[Monitor] Total Cells: 3 [ 5 s ]
[Monitor] Total Cells: 2 [ 6 s ]
[Monitor] Total Cells: 1 [ 7 s ]
[Monitor] Total Cells: 0 [ 8 s ]

while this is my output:

[Main] Please input a list of gene seeds: 
1 2 3 4 5 6 7
[Monitor] Started [ 0 s ]
[Monitor] Total cells: 1 [ 1 s ] 
[Monitor] Total cells: 2 [ 2 s ] 
[Monitor] Total cells: 3 [ 3 s ] 
[Monitor] Total cells: 4 [ 4 s ] 
[Monitor] Total cells: 5 [ 5 s ] 
[Monitor] Total cells: 6 [ 6 s ] 
[Monitor] Total cells: 7 [ 7 s ] 

As you can see, I cannot figure out where the Monitor function fits into all this, and how I can improve my code. Right now I have no monitor function and the thread function prints out the number of cells. Any suggestions about improving the code will be very helpful!

#include <iostream>
#include <thread>
#include <string>
#include <sstream>
#include<vector>
#include <chrono>
#include <mutex>
#include <stdlib.h>
using namespace std;
vector<int> inputs;
vector<thread> threads;
int total = 0, counter=0;

thread thread_obj;
int total_cells= 0;
class Counter //to count the seconds passed
{
    int number;
    mutex mute;
public:
    Counter() :number(0){}
    int getNumber() { return number; }
    int increase()//increases the counter
    {
        mute.lock();//locks so that only one thread can access this function
        number++;
        mute.unlock();
        return number;
    }
    void decrease()//decreases timer
{
        mute.lock();
        number--;
        mute.unlock();
}

};
Counter timer;

void thread_function(int x)
{   
    int lifeTime= (0.1 + x % 8); //equation for calculating lifeTime
    int y = (x-x%8) / 8 ; //cell number that child breeds



    timer.increase();

    total=total+1;

    if (timer.getNumber() == lifeTime/2){//if timer is half the cell's lifetime

        total=total+1;
        thread_function(y);//call thread function on the child cell
    }
    cout<<"[Monitor] Total cells: "<< total << " [ " << timer.getNumber() <<" s ] "<<endl;
    if(total == 0){
        exit(0); //program reaches end when total cells are zero
    }


}


int main()
{   
    cout<<"[Main] Please input a list of gene seeds: "<<endl;
    int value;
    string line;
    getline(cin, line);
    istringstream iss(line);
    while(iss >> value){

       inputs.push_back(value);
    }
   threads.reserve(inputs.size());
    cout<<"[Monitor] Started [ 0 s ]"<<endl;
    thread monitortime(Monitor, total);
      for (int unsigned i = 0; i < inputs.size(); i++) {
        threads.push_back(thread{thread_function, inputs.at(i)});  
        //creates vector containing threads and passing them to thread function


     }
    for (int unsigned i = 0; i < inputs.size(); i++) {
    threads[i].join(); //joins all the threads
}
    return 0;

}

mercredi 25 décembre 2019

C++: How to Implement Chrono in this code

I am new to using chrono so any suggestions at all would be appreciated. The following program takes in a vector and passes each element as a single thread. Now, the chrono should take each thread object and perform a computation of it. I'm not well-versed with the syntax so am not sure how to implement it properly.

Here is the code. The variable half_life is supposed to run the function whenever lifetime is half its original size.

#include <iostream>
#include <thread>
#include <string>
#include <sstream>
#include<vector>
#include <chrono>
#include <mutex>
#include <stdlib.h>
using namespace std;
vector<int> inputs;

int total = 0, counter=0;
int totally= 0;
thread thread_obj;
int total_cells= 0;
class Counter
{
    int number;
    mutex mute;
public:
    Counter() :number(0){}
    int getNumber() { return number; }
    int increase()
    {
        mute.lock();
        number++;
        mute.unlock();
        return number;
    }
    void decrease()
{
        mute.lock();
        number--;
        mute.unlock();
}

};
Counter timer;

void thread_function(int x)
{   using namespace std::chrono;
    int lifeTime= (0.1 + x % 8);
    int y = (x-x%8) / 8 ;
    int half_life;


    timer.increase();


    half_life = std::thread_function::sleep_for(std::chrono::milliseconds((int)(0.5 * 1000 * lifeTime))); 
//this is the chrono function

    if (timer.getNumber() == half_life){

        totally=totally+y;
        thread_function(y);
    }
    cout<<"[Monitor] Total cells: "<< totally << " [ " << timer.getNumber() <<" s ] "<<endl;
    if(totally == 0){
        exit(0);
    }


}


int main()
{   
    cout<<"[Main] Please input a list of gene seeds: "<<endl;
    int value;
    string line;
    getline(cin, line);
    istringstream iss(line);
    while(iss >> value){

       inputs.push_back(value);
    }

    cout<<"[Monitor] Started [ 0 s ]"<<endl;
    for (int unsigned i = 0; i < inputs.size(); i++) {
        thread thread_obj(thread_function, inputs.at(i));
        thread_obj.join();
     }



    return 0;

}

Unexpected Output Type From decltype

I've been experimenting with decltype, trying to figure out the potential benefits of it. I ran this very simple function:

template<class T, class U>
auto MyFunc(T t, U u) -> decltype(t < u ? t : u)
{
  return t < u ? t : u;
}

when calling the function:

auto d = MyFunc(3,3.5);

std::cout << d<<'\n';
std::cout<<"type: "<<typeid(d).name();

I get the following result:

3
type: d

My question is why the returned type is d (decimal) not i (integer)? Thanks!

Find out in linear time whether there is a pair in sorted vector that adds up to certain value

Given an std::vector of distinct elements sorted in ascending order, I want to develop an algorithm that determines whether there are two elements in the collection whose sum is a certain value, sum.

I've tried two different approaches:

  1. I can scan the whole vector and, for each element in the vector, apply binary search (std::lower_bound) on the vector for searching an element corresponding to the difference between sum and the current element. This is an O(n log n) time solution that requires no additional space.

  2. I can traverse the whole vector and populate an std::unordered_set. Then, I scan the vector and, for each element, I look up in the std::unordered_set for the difference between sum and the current element. Since searching on a hash table runs in constant time on average, this solution runs in linear time. However, this solution requires additional linear space because of the std::unordered_set data structure.

Nevertheless, I'm looking for a solution that runs in linear time and requires no additional linear space. Any ideas? It seems that I'm forced to trade speed for space.

Create a std::thread object in thread A, join in thread B

Is it allowed to call join() on a std::thread object that was created in a different thread, given that the object is properly synchronized between threads?

For example:

void cleanup(std::thread t)
{
    t.join();
}

int main()
{
    std::thread t{[] { /* something */ }};

    std::thread c{cleanup, std::move(t)};
    c.join();
}

Something wrong when I tried to add C++11 support to my Xcode project in Mac Terminal

I have a Xcode project built by Cmake, this project needs C++ 11 support, I used to do this in my Xcode project settings: change "C++ Language Dialect" to "GNU++11[std=gnu++1]" and change "C++ Standard Library:" to "libc++(LLVM C++ standard library with C++ 11 support)", which is a manually work. But now I have to do it on Jenkins, so all the stuff must be implemented in my Mac Terminal.

This is the procedure before:

mkdir -p build_ios && cd build_ios
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake   -GXcode ../
(open Xcode project, change settings to support C++11 in Navigation project)
cd ..
cmake --build build_ios --config Release

Now I do this:

mkdir -p build_ios && cd build_ios
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake   -GXcode ../
clang++ -std=c++11 -stdlib=libc++ -Weverything ../../../Src/libRecastDLL.cpp -I ../../../../Navigation -I ../../../../Detour
cd ..
cmake --build build_ios --config Release

By the way, this project is used to produce libRecast.a file, I add "-I ../../../../Navigation -I ../../../../Detour" because it tells me some header file cannot be found.

here is the wrong msg:

In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
../../../../Navigation/NavMesh.h:2:9: warning: macro name is a reserved
      identifier [-Wreserved-id-macro]
#define _NAVMESH_H_
        ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:5:
../../../../Detour/DetourNavMesh.h:102:26: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_TILE_FREE_DATA = 0x01,
                                ^
../../../../Detour/DetourNavMesh.h:110:43: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04,      ///< The vertex ...
                                                 ^
../../../../Detour/DetourNavMesh.h:117:38: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_STRAIGHTPATH_ALL_CROSSINGS = 0x02,   ///< Add a vertex at eve...
                                            ^
../../../../Detour/DetourNavMesh.h:124:30: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_FINDPATH_ANY_ANGLE   = 0x02,         ///< use raycasts durin...
                                      ^
../../../../Detour/DetourNavMesh.h:130:29: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_RAYCAST_USE_COSTS = 0x01,            ///< Raycast should calc...
                                   ^
../../../../Detour/DetourNavMesh.h:144:36: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_POLYTYPE_OFFMESH_CONNECTION = 1,
                                          ^
../../../../Detour/DetourNavMesh.h:176:76: warning: implicit conversion loses
      integer precision: 'int' to 'unsigned char' [-Wimplicit-int-conversion]
  ...char t) { areaAndtype = (areaAndtype & 0x3f) | (t << 6); }
                           ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
../../../../Detour/DetourNavMesh.h:519:11: warning: use of old-style cast
      [-Wold-style-cast]
                return ((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((...
                        ^          ~~~~
../../../../Detour/DetourNavMesh.h:519:58: warning: use of old-style cast
      [-Wold-style-cast]
  ...((dtPolyRef)salt << (m_polyBits+m_tileBits)) | ((dtPolyRef)it << m_polyB...
                                                     ^          ~~
../../../../Detour/DetourNavMesh.h:519:89: warning: use of old-style cast
      [-Wold-style-cast]
  ...| ((dtPolyRef)it << m_polyBits) | (dtPolyRef)ip;
                                       ^          ~~
../../../../Detour/DetourNavMesh.h:540:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:541:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:542:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:543:10: warning: use of old-style cast
      [-Wold-style-cast]
  ...salt = (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
            ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourNavMesh.h:544:8: warning: use of old-style cast
      [-Wold-style-cast]
                it = (unsigned int)((ref >> m_polyBits) & tileMask);
                     ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourNavMesh.h:545:8: warning: use of old-style cast
      [-Wold-style-cast]
                ip = (unsigned int)(ref & polyMask);
                     ^             ~~~~~~~~~~~~~~~~
../../../../Detour/DetourNavMesh.h:559:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef saltMask = ((dtPolyRef)1<<m_saltBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:560:10: warning: use of old-style cast
      [-Wold-style-cast]
  ...return (unsigned int)((ref >> (m_polyBits+m_tileBits)) & saltMask);
            ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourNavMesh.h:574:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef tileMask = ((dtPolyRef)1<<m_tileBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:575:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)((ref >> m_polyBits) & tileMask);
                       ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourNavMesh.h:589:31: warning: use of old-style cast
      [-Wold-style-cast]
                const dtPolyRef polyMask = ((dtPolyRef)1<<m_polyBits)-1;
                                            ^          ~
../../../../Detour/DetourNavMesh.h:590:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)(ref & polyMask);
                       ^             ~~~~~~~~~~~~~~~~
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:6:
../../../../Detour/DetourNavMeshQuery.h:403:19: warning: parameter 'flags' not
      found in the function declaration [-Wdocumentation]
        ///  @param[in]         flags           govern how the raycast b...
                                ^~~~~
../../../../Detour/DetourNavMeshQuery.h:403:19: note: did you mean 'options'?
        ///  @param[in]         flags           govern how the raycast b...
                                ^~~~~
                                options
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:7:
../../../../Detour/DetourTileCache.h:15:36: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
  ...= 0x01,                                    ///< Navmesh owns the tile m...
           ^
../../../../Detour/DetourTileCache.h:35:22: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_OBSTACLE_REMOVING,
                            ^
../../../../Detour/DetourTileCache.h:42:26: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
        DT_OBSTACLE_ORIENTED_BOX, // OBB
                                ^
../../../../Detour/DetourTileCache.h:222:17: warning: commas at the end of
      enumerator lists are incompatible with C++98 [-Wc++98-compat-pedantic]
                REQUEST_REMOVE,
                              ^
../../../../Detour/DetourTileCache.h:162:77: warning: zero as null pointer
      constant [-Wzero-as-null-pointer-constant]
  ...float dt, class dtNavMesh* navmesh, bool* upToDate = 0);
                                                          ^
                                                          nullptr
../../../../Detour/DetourTileCache.h:176:11: warning: use of old-style cast
      [-Wold-style-cast]
                return ((dtCompressedTileRef)salt << m_tileBits) | (dtCo...
                        ^                    ~~~~
../../../../Detour/DetourTileCache.h:176:54: warning: use of old-style cast
      [-Wold-style-cast]
  ...((dtCompressedTileRef)salt << m_tileBits) | (dtCompressedTileRef)it;
                                                 ^                    ~~
../../../../Detour/DetourTileCache.h:182:41: warning: use of old-style cast
      [-Wold-style-cast]
  ...const dtCompressedTileRef saltMask = ((dtCompressedTileRef)1<<m_saltBits...
                                           ^                    ~
../../../../Detour/DetourTileCache.h:183:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)((ref >> m_tileBits) & saltMask);
                       ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourTileCache.h:189:41: warning: use of old-style cast
      [-Wold-style-cast]
  ...const dtCompressedTileRef tileMask = ((dtCompressedTileRef)1<<m_tileBits...
                                           ^                    ~
../../../../Detour/DetourTileCache.h:190:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)(ref & tileMask);
                       ^             ~~~~~~~~~~~~~~~~
../../../../Detour/DetourTileCache.h:196:11: warning: use of old-style cast
      [-Wold-style-cast]
                return ((dtObstacleRef)salt << 16) | (dtObstacleRef)it;
                        ^              ~~~~
../../../../Detour/DetourTileCache.h:196:40: warning: use of old-style cast
      [-Wold-style-cast]
                return ((dtObstacleRef)salt << 16) | (dtObstacleRef)it;
                                                     ^              ~~
../../../../Detour/DetourTileCache.h:202:35: warning: use of old-style cast
      [-Wold-style-cast]
                const dtObstacleRef saltMask = ((dtObstacleRef)1<<16)-1;
                                                ^              ~
../../../../Detour/DetourTileCache.h:203:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)((ref >> 16) & saltMask);
                       ^             ~~~~~~~~~~~~~~~~~~~~~~~~
../../../../Detour/DetourTileCache.h:209:35: warning: use of old-style cast
      [-Wold-style-cast]
                const dtObstacleRef tileMask = ((dtObstacleRef)1<<16)-1;
                                                ^              ~
../../../../Detour/DetourTileCache.h:210:10: warning: use of old-style cast
      [-Wold-style-cast]
                return (unsigned int)(ref & tileMask);
                       ^             ~~~~~~~~~~~~~~~~
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
../../../../Navigation/NavMesh.h:48:89: warning: 'nullptr' is incompatible with
      C++98 [-Wc++98-compat]
  ...start, const float* end, float* hitpt, float* out_tangent = nullptr);
                                                                 ^
../../../../Navigation/NavMesh.h:59:23: warning: zero as null pointer constant
      [-Wzero-as-null-pointer-constant]
                        float* outPoints = 0, int* outPointCount = 0);
                                           ^
                                           nullptr
../../../../Navigation/NavMesh.h:59:47: warning: zero as null pointer constant
      [-Wzero-as-null-pointer-constant]
                        float* outPoints = 0, int* outPointCount = 0);
                                                                   ^
                                                                   nullptr
../../../../Navigation/NavMesh.h:113:51: warning: 'nullptr' is incompatible with
      C++98 [-Wc++98-compat]
                void tileCacheUpdate(float dt, bool* complete = nullptr);
                                                                ^
../../../../Navigation/NavMesh.h:86:26: warning: zero as null pointer constant
      [-Wzero-as-null-pointer-constant]
                        if (debug_log_func != NULL)
                                              ^~~~
                                              nullptr
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include/stddef.h:100:18: note:
      expanded from macro 'NULL'
#    define NULL __null
                 ^
In file included from ../../../Src/libRecastDLL.cpp:1:
../../../Src/libRecastDLL.h:21:7: warning: no previous extern declaration for
      non-static variable 'LoadSucceed' [-Wmissing-variable-declarations]
        bool LoadSucceed = false;
             ^
../../../Src/libRecastDLL.cpp:4:16: warning: declaration requires an exit-time
      destructor [-Wexit-time-destructors]
static NavMesh sdg_nav;
               ^
../../../Src/libRecastDLL.cpp:4:16: warning: declaration requires a global
      destructor [-Wglobal-constructors]
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
../../../../Navigation/NavMesh.h:82:11: warning: padding class
      'RecastNavigation::NavMesh' with 4 bytes to align 'debug_log_func'
      [-Wpadded]
                FuncPtr debug_log_func;
                        ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:5:
../../../../Detour/DetourNavMesh.h:649:15: warning: padding class 'dtNavMesh'
      with 4 bytes to align 'm_posLookup' [-Wpadded]
        dtMeshTile** m_posLookup;                       ///< Tile hash lookup.
                     ^
../../../../Detour/DetourNavMesh.h:323:7: warning: padding size of 'dtNavMesh'
      with 4 bytes to alignment boundary [-Wpadded]
class dtNavMesh
      ^
../../../../Detour/DetourNavMesh.h:186:8: warning: padding size of
      'dtPolyDetail' with 2 bytes to alignment boundary [-Wpadded]
struct dtPolyDetail
       ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:6:
../../../../Detour/DetourNavMeshQuery.h:550:18: warning: padding struct
      'dtNavMeshQuery::dtQueryData' with 4 bytes to align 'lastBestNode'
      [-Wpadded]
                struct dtNode* lastBestNode;
                               ^
../../../../Detour/DetourNavMeshQuery.h:554:24: warning: padding struct
      'dtNavMeshQuery::dtQueryData' with 4 bytes to align 'filter' [-Wpadded]
                const dtQueryFilter* filter;
                                     ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:7:
../../../../Detour/DetourTileCache.h:243:20: warning: padding class
      'dtTileCache' with 4 bytes to align 'm_talloc' [-Wpadded]
        dtTileCacheAlloc* m_talloc;
                          ^
../../../../Detour/DetourTileCache.h:21:33: warning: padding struct
      'dtCompressedTile' with 4 bytes to align 'header' [-Wpadded]
        struct dtTileCacheLayerHeader* header;
                                       ^
../../../../Detour/DetourTileCache.h:24:17: warning: padding struct
      'dtCompressedTile' with 4 bytes to align 'data' [-Wpadded]
        unsigned char* data;
                       ^
../../../../Detour/DetourTileCache.h:82:23: warning: padding struct
      'dtTileCacheObstacle' with 2 bytes to align 'next' [-Wpadded]
        dtTileCacheObstacle* next;
                             ^
../../../Src/libRecastDLL.cpp:91:57: warning: zero as null pointer constant
      [-Wzero-as-null-pointer-constant]
        return sdg_nav.raycast(startPoint, endPoint, hitPoint, 0);
                                                               ^
                                                               nullptr
../../../Src/libRecastDLL.cpp:219:2: warning: C++98 requires newline at end of
      file [-Wc++98-compat-pedantic]
}
 ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:6:
../../../../Detour/DetourNavMeshQuery.h:154:7: warning: 'dtPolyQuery' has no
      out-of-line virtual method definitions; its vtable will be emitted in
      every translation unit [-Wweak-vtables]
class dtPolyQuery
      ^
In file included from ../../../Src/libRecastDLL.cpp:1:
In file included from ../../../Src/libRecastDLL.h:4:
In file included from ../../../../Navigation/NavMesh.h:7:
../../../../Detour/DetourTileCache.h:98:8: warning: 'dtTileCacheMeshProcess' has
      no out-of-line virtual method definitions; its vtable will be emitted in
      every translation unit [-Wweak-vtables]
struct dtTileCacheMeshProcess
       ^
63 warnings generated.
Undefined symbols for architecture x86_64:
  "RecastNavigation::NavMesh::setExtents(float, float, float)", referenced from:
      _setExtents in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::addObstacle(float const*, float, float, unsigned int*)", referenced from:
      _addObstacle in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::loadNavMesh(char const*)", referenced from:
      _loadNavMeshData in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::setAreaCost(int, float)", referenced from:
      _setAreaCost in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::findFullPath(float const*, float const*, float*, int&, unsigned char*, unsigned int*, unsigned int*)", referenced from:
      _findFullPath in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::nearestPoint(float const*, NavmeshPoint*)", referenced from:
      _nearestPoint in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::addBoxObstacle(float const*, float const*, unsigned int*)", referenced from:
      _addAABBBoxObstacle in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::addBoxObstacle(float const*, float const*, float, unsigned int*)", referenced from:
      _addBoxObstacle in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::findFollowPath(float const*, float const*, float*, int&)", referenced from:
      _findFollowPath in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::findSlicedPath(float const*, float const*, float*, int&)", referenced from:
      _findSlicedPath in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::removeObstacle(unsigned int)", referenced from:
      _removeObstacle in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::getExcludeFlags()", referenced from:
      _getExcludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::getIncludeFlags()", referenced from:
      _getIncludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::setExcludeFlags(unsigned int)", referenced from:
      _setExcludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::setIncludeFlags(unsigned int)", referenced from:
      _setIncludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::tileCacheUpdate(float, bool*)", referenced from:
      _tileCacheUpdate in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::findStraightPath(float const*, float const*, float*, int&, unsigned char*, unsigned int*)", referenced from:
      _findStraightPath in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::resetExcludeFlags()", referenced from:
      _resetExcludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::resetIncludeFlags()", referenced from:
      _resetIncludeFlags in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::loadTileCacheNavMesh(char const*, char const*, float)", referenced from:
      _loadTileCacheNavMeshData in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::buildNavMeshFromBuffer(unsigned char const*, unsigned long, bool)", referenced from:
      _buildNavMeshFromBuffer in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::findRandomPointAroundCircle(NavmeshPoint, float, NavmeshPoint*)", referenced from:
      _randomPoint in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::buildTileCacheNavMeshFromBuffer(unsigned char const*, unsigned long, char*, float)", referenced from:
      _buildTileCacheNavMeshFromBuffer in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::posArea(float, float, float, unsigned char*)", referenced from:
      _posArea in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::raycast(float const*, float const*, float*, float*)", referenced from:
      _raycast in libRecastDLL-a6a712.o
      _raycastGetTangent in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::posHeight(float, float, float&)", referenced from:
      _posHeight in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::NavMesh()", referenced from:
      ___cxx_global_var_init in libRecastDLL-a6a712.o
  "RecastNavigation::NavMesh::~NavMesh()", referenced from:
      ___cxx_global_var_init in libRecastDLL-a6a712.o
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
bigworld@woodyplus build_ios %