Jump to content

Search the Community

Showing results for tags 'linker'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Q&A Desenvolvimento
    • Perguntas e respostas rápidas
  • Web Development
    • HTML e CSS
    • Javascript
    • PHP
    • Ruby
    • Python
    • Java
    • .NET
    • Docker, Kubernets and other environments
    • WordPress
    • Mobile
    • Agile
    • Desenvolvimento de Games
    • Banco de Dados
    • Design and UX
    • Algoritmos & Outras Tecnologias
  • Entretenimento e uso pessoal
    • Segurança & Malwares
    • Geral
    • iMasters's pub

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Google+


Hangouts


Skype


Twitter


deviantART


Github


Flickr


LinkedIn


Pinterest


Facebook


Site Pessoal


Localização


Interesses

Found 2 results

  1. Mateus GP

    Linker não encontra referências

    Boa noite. Estou tendo problemas para compilar um código, não tenho ideia do que está acontecendo. main.cpp #include <iostream> #include "vector2.hpp" int main(int, char **) { Vector2f test; //test = (const float)0.0f; test.dot(test); return 0; } vector2.hpp #ifndef vector2_header #define vector2_header #include <cmath> template <typename number_t> class Vector2; template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator+(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator-(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator*(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator/(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> class Vector2 { public: number_t x; number_t y; Vector2() : x(0.), y(0.) {} Vector2(const number_t x_, const number_t y_) : x(x_), y(y_) {} Vector2(const Vector2 &v2d) : x(v2d.x), y(v2d.y) {} friend Vector2 operator+<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator+<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator+<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator-<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator-<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator-<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator*<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator*<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator*<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator/<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator/<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator/<number_t>(const number_t lhs, const Vector2 &rhs); Vector2 &operator=(const Vector2 &rhs); Vector2 &operator=(const number_t &rhs); Vector2 &operator+=(const Vector2 &rhs); Vector2 &operator+=(const number_t rhs); Vector2 &operator-=(const Vector2 &rhs); Vector2 &operator-=(const number_t rhs); Vector2 &operator*=(const Vector2 &rhs); Vector2 &operator*=(const number_t rhs); Vector2 &operator/=(const Vector2 &rhs); Vector2 &operator/=(const number_t rhs); number_t lenghtSq() const; number_t lenght() const; number_t dot(const Vector2 &rhs) const; number_t cross(const Vector2 &rhs) const; Vector2 &rotate(const number_t rad); Vector2 rotated(const number_t rad) const; Vector2 &normalize(); Vector2 normalized() const; number_t distanceSq(const Vector2 &rhs) const; number_t distance(const Vector2 &rhs) const; number_t angle(const Vector2 &rhs) const; Vector2 absv() const; }; typedef Vector2<float> Vector2f; #endif // !vector2_header vector2.cpp #include "vector2.hpp" template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x + rhs.x, lhs.y + rhs.y); } template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x + rhs, lhs.y + rhs); } template <typename number_t> Vector2<number_t> operator+(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs + rhs.x, lhs + rhs.y); } template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x - rhs.x, lhs.y - rhs.y); } template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x - rhs, lhs.y - rhs); } template <typename number_t> Vector2<number_t> operator-(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs - rhs.x, lhs - rhs.y); } template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x * rhs.x, lhs.y * rhs.y); } template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x * rhs, lhs.y * rhs); } template <typename number_t> Vector2<number_t> operator*(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs * rhs.x, lhs * rhs.y); } template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x / rhs.x, lhs.y / rhs.y); } template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x / rhs, lhs.y / rhs); } template <typename number_t> Vector2<number_t> operator/(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs / rhs.x, lhs / rhs.y); } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator=(const Vector2<number_t> &rhs) { if(this != &rhs) { x = rhs.x; y = rhs.y; } return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator=(const number_t &rhs) { x = rhs; y = rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator+=(const Vector2<number_t> &rhs) { x += rhs.x; y += rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator+=(const number_t rhs) { x += rhs; y += rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator-=(const Vector2<number_t> &rhs) { x -= rhs.x; y -= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator-=(const number_t rhs) { x -= rhs; y -= rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator*=(const Vector2<number_t> &rhs) { x *= rhs.x; y *= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator*=(const number_t rhs) { x *= rhs; y *= rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator/=(const Vector2<number_t> &rhs) { x /= rhs.x; y /= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator/=(const number_t rhs) { x /= rhs; y /= rhs; return *this; } template <typename number_t> number_t Vector2<number_t>::lenghtSq() const { return x * x + y * y; } template <typename number_t> number_t Vector2<number_t>::lenght() const { return sqrt(x * x + y * y); } template <typename number_t> number_t Vector2<number_t>::dot(const Vector2<number_t> &rhs) const { return x * rhs.x + y * rhs.y; } template <typename number_t> number_t Vector2<number_t>::cross(const Vector2<number_t> &rhs) const { return x * rhs.x - y * rhs.y; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::rotate(const number_t rad) { const number_t tx(x), dc(cos(rad)), ds(sin(rad)); x = x * dc - y * ds; y = tx * ds + y * dc; return *this; } template <typename number_t> Vector2<number_t> Vector2<number_t>::rotated(const number_t rad) const { Vector2<number_t> nw(*this); return nw.rotate(rad); } template <typename number_t> Vector2<number_t> &Vector2<number_t>::normalize() { const number_t len(1. / lenght()); x *= len; y *= len; return *this; } template <typename number_t> Vector2<number_t> Vector2<number_t>::normalized() const { Vector2<number_t> nw(*this); return nw.normalize(); } template <typename number_t> number_t Vector2<number_t>::distanceSq(const Vector2<number_t> &rhs) const { const number_t dx(x - rhs.x); const number_t dy(y - rhs.y); return dx * dx + dy * dy; } template <typename number_t> number_t Vector2<number_t>::distance(const Vector2<number_t> &rhs) const { const number_t dx(x - rhs.x); const number_t dy(y - rhs.y); return sqrt(dx * dx + dy * dy); } template <typename number_t> number_t Vector2<number_t>::angle(const Vector2<number_t> &rhs) const { Vector2<number_t> nv(normalized()); number_t ang(nv.dot(rhs.normalized())); if (ang > 1.0) ang = 1.0; if (ang < -1.0) ang = -1.0; return -acos(ang); } template <typename number_t> Vector2<number_t> Vector2<number_t>::absv() const { return Vector2<number_t>(abs(x), abs(y)); } O problema é que aparentemente funciona se copiar o código de vector2.cpp para main.cpp. Alguém tem alguma sugestão? Se houver outra fora o problema, também é bem-vinda. Obs: já tentei compilar pelo terminal também. CMakeLists.txt
  2. Mateus GP

    Linker não encontra referências

    #include <iostream> #include "vector2.hpp" int main(int, char **) { Vector2f test; //test = (const float)0.0f; test.dot(test); return 0; } #ifndef vector2_header #define vector2_header #include <cmath> template <typename number_t> class Vector2; template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator+(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator-(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator*(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs); template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const number_t rhs); template <typename number_t> Vector2<number_t> operator/(const number_t lhs, const Vector2<number_t> &rhs); template <typename number_t> class Vector2 { public: number_t x; number_t y; Vector2() : x(0.), y(0.) {} Vector2(const number_t x_, const number_t y_) : x(x_), y(y_) {} Vector2(const Vector2 &v2d) : x(v2d.x), y(v2d.y) {} friend Vector2 operator+<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator+<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator+<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator-<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator-<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator-<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator*<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator*<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator*<number_t>(const number_t lhs, const Vector2 &rhs); friend Vector2 operator/<number_t>(const Vector2 &lhs, const Vector2 &rhs); friend Vector2 operator/<number_t>(const Vector2 &lhs, const number_t rhs); friend Vector2 operator/<number_t>(const number_t lhs, const Vector2 &rhs); Vector2 &operator=(const Vector2 &rhs); Vector2 &operator=(const number_t &rhs); Vector2 &operator+=(const Vector2 &rhs); Vector2 &operator+=(const number_t rhs); Vector2 &operator-=(const Vector2 &rhs); Vector2 &operator-=(const number_t rhs); Vector2 &operator*=(const Vector2 &rhs); Vector2 &operator*=(const number_t rhs); Vector2 &operator/=(const Vector2 &rhs); Vector2 &operator/=(const number_t rhs); number_t lenghtSq() const; number_t lenght() const; number_t dot(const Vector2 &rhs) const; number_t cross(const Vector2 &rhs) const; Vector2 &rotate(const number_t rad); Vector2 rotated(const number_t rad) const; Vector2 &normalize(); Vector2 normalized() const; number_t distanceSq(const Vector2 &rhs) const; number_t distance(const Vector2 &rhs) const; number_t angle(const Vector2 &rhs) const; Vector2 absv() const; }; typedef Vector2<float> Vector2f; #endif // !vector2_header #include "vector2.hpp" template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x + rhs.x, lhs.y + rhs.y); } template <typename number_t> Vector2<number_t> operator+(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x + rhs, lhs.y + rhs); } template <typename number_t> Vector2<number_t> operator+(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs + rhs.x, lhs + rhs.y); } template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x - rhs.x, lhs.y - rhs.y); } template <typename number_t> Vector2<number_t> operator-(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x - rhs, lhs.y - rhs); } template <typename number_t> Vector2<number_t> operator-(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs - rhs.x, lhs - rhs.y); } template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x * rhs.x, lhs.y * rhs.y); } template <typename number_t> Vector2<number_t> operator*(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x * rhs, lhs.y * rhs); } template <typename number_t> Vector2<number_t> operator*(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs * rhs.x, lhs * rhs.y); } template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs.x / rhs.x, lhs.y / rhs.y); } template <typename number_t> Vector2<number_t> operator/(const Vector2<number_t> &lhs, const number_t rhs) { return Vector2<number_t>(lhs.x / rhs, lhs.y / rhs); } template <typename number_t> Vector2<number_t> operator/(const number_t lhs, const Vector2<number_t> &rhs) { return Vector2<number_t>(lhs / rhs.x, lhs / rhs.y); } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator=(const Vector2<number_t> &rhs) { if(this != &rhs) { x = rhs.x; y = rhs.y; } return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator=(const number_t &rhs) { x = rhs; y = rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator+=(const Vector2<number_t> &rhs) { x += rhs.x; y += rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator+=(const number_t rhs) { x += rhs; y += rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator-=(const Vector2<number_t> &rhs) { x -= rhs.x; y -= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator-=(const number_t rhs) { x -= rhs; y -= rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator*=(const Vector2<number_t> &rhs) { x *= rhs.x; y *= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator*=(const number_t rhs) { x *= rhs; y *= rhs; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator/=(const Vector2<number_t> &rhs) { x /= rhs.x; y /= rhs.y; return *this; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::operator/=(const number_t rhs) { x /= rhs; y /= rhs; return *this; } template <typename number_t> number_t Vector2<number_t>::lenghtSq() const { return x * x + y * y; } template <typename number_t> number_t Vector2<number_t>::lenght() const { return sqrt(x * x + y * y); } template <typename number_t> number_t Vector2<number_t>::dot(const Vector2<number_t> &rhs) const { return x * rhs.x + y * rhs.y; } template <typename number_t> number_t Vector2<number_t>::cross(const Vector2<number_t> &rhs) const { return x * rhs.x - y * rhs.y; } template <typename number_t> Vector2<number_t> &Vector2<number_t>::rotate(const number_t rad) { const number_t tx(x), dc(cos(rad)), ds(sin(rad)); x = x * dc - y * ds; y = tx * ds + y * dc; return *this; } template <typename number_t> Vector2<number_t> Vector2<number_t>::rotated(const number_t rad) const { Vector2<number_t> nw(*this); return nw.rotate(rad); } template <typename number_t> Vector2<number_t> &Vector2<number_t>::normalize() { const number_t len(1. / lenght()); x *= len; y *= len; return *this; } template <typename number_t> Vector2<number_t> Vector2<number_t>::normalized() const { Vector2<number_t> nw(*this); return nw.normalize(); } template <typename number_t> number_t Vector2<number_t>::distanceSq(const Vector2<number_t> &rhs) const { const number_t dx(x - rhs.x); const number_t dy(y - rhs.y); return dx * dx + dy * dy; } template <typename number_t> number_t Vector2<number_t>::distance(const Vector2<number_t> &rhs) const { const number_t dx(x - rhs.x); const number_t dy(y - rhs.y); return sqrt(dx * dx + dy * dy); } template <typename number_t> number_t Vector2<number_t>::angle(const Vector2<number_t> &rhs) const { Vector2<number_t> nv(normalized()); number_t ang(nv.dot(rhs.normalized())); if (ang > 1.0) ang = 1.0; if (ang < -1.0) ang = -1.0; return -acos(ang); } template <typename number_t> Vector2<number_t> Vector2<number_t>::absv() const { return Vector2<number_t>(abs(x), abs(y)); }
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.