IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C++ Discussion :

Erreur de compilation sous windows. (avec mingw)


Sujet :

C++

  1. #21
    Expert confirmé

    Avatar de dragonjoker59
    Homme Profil pro
    Software Developer
    Inscrit en
    Juin 2005
    Messages
    2 036
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Software Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2005
    Messages : 2 036
    Billets dans le blog
    12
    Par défaut
    Mouais, ça ne me semble pas être le problème, mais il faut vraiment que tu utilises les initialiser list dans tes constructeurs, la manière dont tu les écris est vraiment une mauvaise pratique.

    On peut voir BoundingSphere.h et le fichier .cpp à partir duquel l'erreur part?
    Si vous ne trouvez plus rien, cherchez autre chose...

    Vous trouverez ici des tutoriels OpenGL moderne.
    Mon moteur 3D: Castor 3D, presque utilisable (venez participer, il y a de la place)!
    Un projet qui ne sert à rien, mais qu'il est joli (des fois) : ProceduralGenerator (Génération procédurale d'images, et post-processing).

  2. #22
    Invité
    Invité(e)
    Par défaut
    Ok les voicis :

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
     
    #ifndef ODFAEG_BOUNDING_SPHERE_HPP
    #define ODFAEG_BOUNDING_SPHERE_HPP
    #include "../Math/vec2f.h"
    #include "../Math/ray.h"
    #include "boundingVolume.h"
    /**
      *\namespace odfaeg
      * the namespace of the Opensource Development Framework Adapted for Every Games.
      */
    namespace odfaeg {
        namespace physic {
            /**
              * \file boundingSphere.h
              * \class BoudingSphere
              * \brief Manage a bounding sphere for collision detection
              * \author Duroisin.L
              * \version 1.0
              * \date 1/02/2014
              *
              * Manage a bounding sphere for collision detection.
              *
              */
            class BoundingEllipsoid;
            class OrientedBoundingBox;
            class BoundingPolyhedron;
            class BoundingBox;
            class BoundingSphere : public BoundingVolume {
                public :
                    BoundingSphere();
                    /**
                    * \fn BoundingSphere (Vec2f center, float radius)
                    * \brief Constructor : create an instance of a bounding sphere.
                    * \param the center of the bounding sphere.
                    * \param the radius of the bounding sphere.
                    */
                    BoundingSphere (math::Vec3f center, float radius);
                    /**\fn bool intersects (BoundingSphere &other)
                     * \brief check if the bounding sphere is in collision with an other.
                     * \param the other bounding sphere to test with.
                     * \return the result of the collision test.
                     */
                    bool onIntersects (BaseInterface& interface, CollisionResultSet::Info& info) {
                        return interface.intersects(*this, info);
                    }
                    bool onIntersects (BaseInterface& interface, math::Ray& ray, bool segment, CollisionResultSet::Info& info) {
                        return interface.intersects(ray, segment, info);
                    }
                    bool onIntersects (BaseInterface& interface, math::Ray& ray, math::Vec3f& near, math::Vec3f& far, CollisionResultSet::Info& info) {
                        return interface.intersectsWhere(ray, near, far, info);
                    }
                    bool intersects (BoundingSphere &other, CollisionResultSet::Info& info);
                    /** \fn bool intersects (BoundingEllipsoid &be)
                     *  \brief check if the bounding sphere is in collision with a bounding ellipsoid.
                     *  \param the bouding ellipsoid to test with.
                     *  \return the result of the collision test.
                     */
                    bool intersects (BoundingEllipsoid &be, CollisionResultSet::Info& info);
                    /** \fn bool intersects (BoundingBox &br)
                     *  \brief check if the bounding sphere is in collision with a bounding box.
                     *  \param the bounding box to test with.
                     *  \return the result of the collision test.
                     */
                    bool intersects (BoundingBox &obr, CollisionResultSet::Info& info);
                    /**\fn bool intersects (OrientedBoundingRectangle &obr)
                    *  \brief check if the bounding sphere is in collision with an oriented bounding box.
                    *  \param the oriented bounding box to test with.
                    *  \return the result of the collision test.
                    */
                    bool intersects (OrientedBoundingBox &obr, CollisionResultSet::Info& info);
                    /**\fn bool intersects (BoundingPolygon &bp)
                    *  \brief check if the bounding sphere is in collision with a bounding polyhedron.
                    *  \param the bounding polyhedron to test with.
                    *  \return the result of the collision test.
                    */
                    bool intersects (BoundingPolyhedron &bp, CollisionResultSet::Info& info);
                    /** \fn bool isPointInside (Vec2f &point)
                     *  \brief check if a point is inside the sphere.
                     *  \param the point to test in.
                     *  \return the result of the collision test.
                     */
                    bool isPointInside (math::Vec3f &point);
                    /** \fn bool intersects (Segment &ray)
                     *  \brief check if a ray interects the sphere.
                     *  \param the ray to test with.
                     *  \return the result of the collision test.
                     */
                    bool intersects (math::Ray& ray, bool segment, CollisionResultSet::Info& info);
                    /** \fn bool intersects (Segment &ray, Vec2f &near, Vec2f &far)
                     *  \brief check if a ray interects the sphere and get the points of the intersection.
                     *  \param the ray to test with.
                     *  \param the vector to store the nearest point of the intersection. (from the ray's origin)
                     *  \param the vector to store the farest point of the intersection. (from the ray"s origin)
                     *  \return the result of the collision test.
                     */
                    bool intersectsWhere (math::Ray &ray, math::Vec3f &near, math::Vec3f &far, CollisionResultSet::Info& info);
                    /** \fn Vec2f getCenter()
                    *   \return the center of the bounding sphere.
                    */
                    math::Vec3f getPosition();
                    math::Vec3f getCenter();
                    /** \fn Vec2f getRadius()
                    *   \return the radius of the bounding sphere.
                    */
                    math::Vec3f getSize();
                    float getRadius();
                    template <typename Archive>
                    void vtserialize (Archive & ar) {
                        BoundingVolume::vtserialize(ar);
                        ar(center);
                        ar(radius);
                    }
                    void move() {
                    }
                    const BoundingSphere& operator= (const BoundingSphere& other) {
                        *this = other;
                        return *this;
                    }
                    std::unique_ptr<BoundingVolume> clone() {
                        return std::make_unique<BoundingSphere>(*this);
                    }
                    void move (math::Vec3f t);
                    void scale (float s);
                private :
                    math::Vec3f center; /** < the center of the bouding sphere */
                    float radius; /** < the radius of the bouding sphere */
            };
        }
    }
    #endif
    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
     
    #include "../../../include/odfaeg/Physics/boundingSphere.h"
    #include "../../../include/odfaeg/Physics/boundingEllipsoid.h"
    #include "../../../include/odfaeg/Physics/boundingBox.h"
    #include "../../../include/odfaeg/Physics/orientedBoundingBox.h"
    #include "../../../include/odfaeg/Physics/boundingPolyhedron.h"
    #include "../../../include/odfaeg/Graphics/transformMatrix.h"
    using namespace std;
    namespace odfaeg {
        namespace physic {
            /*Crée un cercle englobant, utilisé pour les détection de collisions, et la sélection
            * d'objets.
            */
            //Crée un cercle de centre center et de rayon radius.
            BoundingSphere::BoundingSphere() {
                center = math::Vec3f(0, 0, 0);
                radius = 1;
            }
            BoundingSphere::BoundingSphere (math::Vec3f center, float radius) {
                this->center = center;
                this->radius = radius;
            }
            bool BoundingSphere::intersects (BoundingSphere &other, CollisionResultSet::Info& info) {
                float d = center.computeDist(other.center);
                float rSum = radius + other.radius;
                return (d <= rSum);
            }
            bool BoundingSphere::intersects (BoundingEllipsoid &be, CollisionResultSet::Info& info) {
                return be.intersects(*this, info);
            }
            bool BoundingSphere::intersects (BoundingBox &bx, CollisionResultSet::Info& info) {
                float dist;
                int pIndex, eIndex, fIndex;
                std::vector<math::Vec3f> point = {center};
                int vIndex = math::Computer::checkNearestVertexFromShape(bx.getCenter(), bx.getVertices(), bx.getEdgeBissectors(), bx.getEdgeNormals(),
                                                                         bx.getFaceBissectors(), bx.getFaceNormals(),point,dist,pIndex,eIndex,fIndex,4);
                info.nearestVertexIndex1 = vIndex;
                info.nearestPtIndex1 = pIndex;
                info.nearestEdgeIndex1 = eIndex;
                info.nearestFaceIndex1 = fIndex;
                math::Vec3f v = center - bx.getCenter();
                if (pIndex != -1)
                    return v.magnitude() <= radius + (bx.getVertices()[pIndex] - bx.getCenter()).magnitude();
                math::Vec3f n = bx.getEdgeNormals()[eIndex];
                float pn = math::Math::abs(v.projOnAxis(n));
                info.mtu = n * (radius + (bx.getEdgeBissectors()[eIndex] - bx.getCenter()).magnitude() - pn);
                return pn  <= radius  + (bx.getEdgeBissectors()[eIndex] - bx.getCenter()).magnitude();
            }
     
            bool BoundingSphere::intersects (OrientedBoundingBox &obx, CollisionResultSet::Info& info) {
                 math::Ray ray(obx.getCenter(), center);
                 math::Vec3f near, far;
                 if (!obx.intersectsWhere(ray, near, far, info)) {
                    return false;
                 }
                 math::Vec3f d = far - obx.getCenter();
                 return (center.computeDistSquared(obx.getCenter()) - radius * radius - d.magnSquared()) <= 0;
            }
            bool BoundingSphere::intersects (BoundingPolyhedron &bp, CollisionResultSet::Info& info) {
                 math::Ray ray(bp.getCenter(), center);
                 math::Vec3f near, far;
                 if (!bp.intersectsWhere(ray, near, far, info)) {
                    return false;
                 }
                 math::Vec3f d = far - bp.getCenter();
                 return (center.computeDistSquared(bp.getCenter()) - radius * radius - d.magnSquared()) <= 0;
            }
            bool BoundingSphere::intersects (math::Ray &ray, bool segment, CollisionResultSet::Info& info) {
                if (isPointInside(ray.getOrig()))
                    return true;
                math::Vec3f d1 = center - ray.getOrig();
                float dp = d1.dot2(ray.getDir());
                if (dp < 0)
                    return false;
                math::Vec3f p = ray.getOrig() + ray.getDir().normalize() * d1.projOnAxis(ray.getDir());
                math::Vec3f d2 = p - center;
                if (!segment) {
                    return d2.magnSquared() <= radius * radius;
                } else {
                    if(d2.magnSquared() > radius * radius) {
                        return false;
                    } else {
                        math::Vec3f near, far;
                        intersectsWhere(ray, near, far, info);
                        math::Vec3f v1 = near - ray.getOrig();
                        math::Vec3f v2 = far - ray.getOrig();
                        math::Vec3f d = ray.getExt() - ray.getOrig();
                        float i1 = v1.magnSquared() / d.magnSquared();
                        float i2 = v2.magnSquared() / d.magnSquared();
                        if (i1 <= 1 || i2 <= 1)
                                return true;
                        return false;
                    }
                }
            }
            bool BoundingSphere::intersectsWhere (math::Ray& r, math::Vec3f& near, math::Vec3f &far, CollisionResultSet::Info& info) {
                math::Vec3f p = r.getOrig();
                math::Vec3f d = r.getDir().normalize();
                math::Vec3f c = center;
                 // this is the vector from p to c
                math::Vec3f vpc = c - p;
                if (vpc.dot2(d) < 0) {
                    // when the sphere is behind the origin p
                    // note that this case may be dismissed if it is
                    // considered that p is outside the sphere
                    if (vpc.magnSquared() > radius * radius) {
                        return false; // there is no intersection
                    } else if (vpc.magnSquared() == radius * radius) {
                        near = far = p;
                        return true;
                    } else {
                        // occurs when p is inside the sphere
                        math::Vec3f pc = p + d * vpc.projOnAxis(d);
                        float dist = math::Math::sqrt(radius * radius - pc.computeDistSquared(c));
                        float di1 = dist - pc.computeDist(p);
                        near = p;
                        far = p + d * di1;
                        return true;
                    }
                } else {
                    // center of sphere projects on the ray
                    math::Vec3f pc = p + d * vpc.projOnAxis(d);
                    if (c.computeDistSquared(pc) > radius * radius) {
                        // there is no intersection
                        return false;
                    } else {
                        // distance from pc to i1 and to i2.
                        float dist = math::Math::sqrt((radius * radius) - pc.computeDistSquared(c));
                        float di1, di2;
                        if(vpc.magnSquared() > radius * radius) {
                            di1 = pc.computeDist(p) - dist;
                            near = p + d * di1;
                            di2 = pc.computeDist(p) + dist;
                            far = p + d * di2;
                        } else {
                            // origin is inside the sphere
                            di1 = pc.computeDist(p) + dist;
                            near = p;
                            far = p + d * di1;
                        }
                        return true;
                    }
                }
            }
            //Test si un point est à l'intérieur du cercle.
            bool BoundingSphere::isPointInside (math::Vec3f &point) {
                float d = center.computeDist(point);
                return d <= radius;
            }
            math::Vec3f BoundingSphere::getPosition() {
                return math::Vec3f(center.x - radius, center.y - radius, center.z - radius);
            }
            math::Vec3f BoundingSphere::getCenter() {
                return center;
            }
            math::Vec3f BoundingSphere::getSize() {
                return math::Vec3f(radius * 2, radius * 2, radius * 2);
            }
            float BoundingSphere::getRadius () {
                return radius;
            }
            void BoundingSphere::scale(float s) {
                radius *= s;
            }
            void BoundingSphere::move(math::Vec3f t) {
                center += t;
            }
        }
    }

    Pour ceux qui se poseraient la question, j'inclus collisionResultSet.hpp dans le fichier BoundingVolume.h

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
     
    #ifndef ODFAEG_BOUNDING_VOLUME_HPP
    #define ODFAEG_BOUNDING_VOLUME_HPP
    #include "../Math/vec4.h"
    #include "../Math/ray.h"
    #include <string>
    #include <iostream>
    #include "collisionResultSet.hpp"
    /**
      *\namespace odfaeg
      * the namespace of the Opensource Development Framework Adapted for Every Games.
      */
    namespace odfaeg {
        namespace physic {
            /**
              * \file boundingVolume.h
              * \class BoudingVolume
              * \brief Manage a bounding volume for collision detection
              * \author Duroisin.L
              * \version 1.0
              * \date 1/02/2014
              *
              * Base class of all bouding volumes of the framework used for collision detection.
              *
              */
            class BoundingVolume;
            class BoundingBox;
            class OrientedBoundingBox;
            class BoundingSphere;
            class BoundingEllipsoid;
            class BoundingPolyhedron;
            class BaseInterface {
                 public :
                 virtual bool onIntersects(BaseInterface& other, CollisionResultSet::Info& infos) = 0;
                 virtual bool onIntersects(BaseInterface& bi, math::Ray& ray, bool segment, CollisionResultSet::Info& infos) = 0;
                 virtual bool onIntersects(BaseInterface& bi, math::Ray& ray, math::Vec3f& near, math::Vec3f& far, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (BoundingBox &bb, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (BoundingSphere &bs, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (BoundingEllipsoid &be, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (OrientedBoundingBox &ob, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (BoundingPolyhedron &bp, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersects (math::Ray& ray, bool segment, CollisionResultSet::Info& infos) = 0;
                 virtual bool intersectsWhere (math::Ray& ray, math::Vec3f& near, math::Vec3f& far, CollisionResultSet::Info& infos) = 0;
                 std::vector<BoundingVolume*> getChildren() {
                    std::vector<BoundingVolume*> raws;
                    for (unsigned int i = 0; i < children.size(); i++) {
                        raws.push_back(children[0].get());
                    }
                    return raws;
                 }
                 std::vector<std::unique_ptr<BoundingVolume>> children;
            };
            class BoundingVolume : public BaseInterface, public core::Registered<BoundingVolume> {
            public :
                BoundingVolume () {
     
                }
                void addChild(BoundingVolume* bv) {
                    children.push_back(bv->clone());
                }
                bool intersects(BaseInterface& other, CollisionResultSet::Info& info) {
                    std::vector<BoundingVolume*> tmpChildren = getChildren();
                    std::vector<BoundingVolume*> tmpOtherChildren = other.getChildren();
                    if (tmpChildren.size() == 0 && tmpOtherChildren.size() == 0) {
                        return onIntersects(other, info);
                    }  else if (tmpChildren.size() == 0 && tmpOtherChildren.size() != 0) {
     
                          for (unsigned int i = 0; i < tmpOtherChildren.size(); i++) {
                              if (onIntersects(*tmpOtherChildren[i], info))
                                    return true;
                          }
                    } else {
     
                        for (unsigned int i = 0; i < tmpChildren.size(); i++) {
                            if (tmpOtherChildren.size() == 0) {
                                if (tmpChildren[i]->onIntersects(other, info))
                                        return true;
     
                            } else {
                                for (unsigned j = 0; j < tmpOtherChildren.size(); j++) {
                                     if (tmpChildren[i]->onIntersects(*tmpOtherChildren[j], info))
                                            return true;
                                }
                            }
                        }
                    }
                    return false;
                }
                bool intersects(math::Ray& ray, bool segment, CollisionResultSet::Info& info) {
                    return onIntersects(*this, ray, segment, info);
                }
                bool intersectsWhere(math::Ray& ray, math::Vec3f& near, math::Vec3f& far, CollisionResultSet::Info& info) {
                    return onIntersects(*this, ray, near, far, info);
                }
                virtual math::Vec3f getPosition() = 0;
                virtual math::Vec3f getSize() = 0;
                virtual math::Vec3f getCenter() = 0;
                virtual void move (math::Vec3f t) = 0;
                virtual std::unique_ptr<BoundingVolume> clone () = 0;
                template <typename Archive>
                void vtserialize(Archive & ar) {
                    ar(children);
                }
                virtual ~BoundingVolume() {}
                protected :
                BoundingVolume(const BoundingVolume& other) {
     
                }
                BoundingVolume& operator= (const BoundingVolume& other) {
                    return *this;
                }
            };
        }
    }
    #endif // BOUNDING_AREAS

    Mais ce que je ne comprend pas c'est que si le code n'est pas bon pourquoi il compile sous linux ?

Discussions similaires

  1. Compilation de QMYSQL sous Windows avec MinGW
    Par zebedee dans le forum Bases de données
    Réponses: 19
    Dernier message: 09/08/2012, 01h48
  2. Compilation sous windows avec devc++
    Par dr_octopus74 dans le forum Dev-C++
    Réponses: 4
    Dernier message: 17/01/2007, 23h48
  3. erreur de link sous wxWidgets avec Mingw
    Par pyoda dans le forum wxWidgets
    Réponses: 4
    Dernier message: 28/04/2006, 20h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo