Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Law

Pages: 1 ... 3 4 [5]
61
General / Includes and using-namespaces trouble
« on: July 16, 2014, 10:25:31 pm »
Hello,

I cannot compile my project because g++ seems to have a problem with my includes and using-namespaces.

My main file starts like this:

#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <deque>
#include <array>
#include <vector>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>

using namespace std;
using namespace sf;

class Card;
class Motion;
class Player;

#include "GS.hpp"
#include "Card.hpp"
#include "Player.hpp"
#include "Motion.hpp"
#include "Functions.hpp"
#include "Card.cpp"
#include "Player.cpp"
#include "Motion.cpp"
#include "Functions.cpp"

When I compile my file, I get a bunch of

Code: [Select]
Babel.cpp:(.text+0x1a5): undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
Babel.cpp:(.text+0x1ca): undefined reference to `sf::Transformable::setRotation(float)'
/tmp/ccWFVqF0.o: In function `Card::SleeveSet(sf::Texture*)':
Babel.cpp:(.text+0x28e): undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
/tmp/ccWFVqF0.o: In function `Card::SetRotation(double)':
Babel.cpp:(.text+0x2ea): undefined reference to `sf::Transformable::setRotation(float)'
/tmp/ccWFVqF0.o: In function `Card::Blit()':
Babel.cpp:(.text+0x305): undefined reference to `sf::RenderStates::Default'
Babel.cpp:(.text+0x312): undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
/tmp/ccWFVqF0.o: In function `Card::Scale(double)':
Babel.cpp:(.text+0x36f): undefined reference to `sf::Transformable::setScale(float, float)'
Babel.cpp:(.text+0x38e): undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
Babel.cpp:(.text+0x3b3): undefined reference to `sf::Transformable::setScale(float, float)'
Babel.cpp:(.text+0x3f0): undefined reference to `sf::Transformable::setScale(float, float)'
Babel.cpp:(.text+0x40c): undefined reference to `sf::Sprite::setTexture(sf::Texture const&, bool)'
Babel.cpp:(.text+0x431): undefined reference to `sf::Transformable::setScale(float, float)'
[...]

Someone knows how to handle this? Thanks.

62
General / Re: Won't compile
« on: July 12, 2014, 01:04:07 pm »
Okay I actually formated my drive and started over. I installed LTS 14.04 and a bunch of updates afterwards, and everything works perfectly now! My file compiles just fine.

Thanks a ton :)

63
General / Re: Won't compile
« on: July 11, 2014, 10:24:58 am »
have you tried
sudo apt-get update
sudo apt-get upgrade
after upgrade to Ubuntu 14.04
I still have the problem.

64
General / Re: Won't compile
« on: July 11, 2014, 02:40:25 am »
Okay!

So I'm 14.04 LTS now and my file compiles just fine!
But... When I execute it, here's what I get:

./SFML: error while loading shared libraries: libGLEW.so.1.6: cannot open shared object file: No such file or directory

Almost there!

Edit: Also, now I am experiencing minor problems. I seem to be unable to listen to music through Rhythmbox. Here's what I get once I agreed to install useful packages:

The following packages have unmet dependencies:

gstreamer1.0-plugins-ugly: Depends: libc6 (>= 2.14) but 2.19-0ubuntu6 is to be installed
                           Depends: libdvdread4 (>= 4.1.3) but 4.2.1-2ubuntu1 is to be installed
                           Depends: libgcc1 (>= 1:4.1.1) but 1:4.9-20140406-0ubuntu1 is to be installed
                           Depends: libglib2.0-0 (>= 2.37.3) but 2.40.0-2 is to be installed
                           Depends: liborc-0.4-0 (>= 1:0.4.18) but 1:0.4.18-1ubuntu1 is to be installed
                           Depends: libstdc++6 (>= 4.1.1) but 4.8.2-19ubuntu1 is to be installed
gstreamer1.0-plugins-ugly:i386: Depends: libc6 (>= 2.7) but 2.19-0ubuntu6 is to be installed
                                Depends: libdvdread4 (>= 4.1.3) but 4.2.1-2ubuntu1 is to be installed
                                Depends: libgcc1 (>= 1:4.1.1) but 1:4.9-20140406-0ubuntu1 is to be installed
                                Depends: libglib2.0-0 (>= 2.37.3) but 2.40.0-2 is to be installed
                                Depends: liborc-0.4-0 (>= 1:0.4.18) but 1:0.4.18-1ubuntu1 is to be installed
                                Depends: libstdc++6 (>= 4.1.1) but 4.8.2-19ubuntu1 is to be installed

65
General / Re: Won't compile
« on: July 10, 2014, 09:23:08 pm »
Sorry I meant usr/lib/i386-linux-gnu (this depends if you have 32 or 64bit instalation)

Have you installed SFML via repository? What Linux distribution are you using?
When you are in terminal did you cd to the directory where is your .cpp ?
Also why are you not using IDE like codeblocks?
Nothing there either. I have Ubuntu 12.04 LTS. 64 bits. My .cpp file is located in some random directory in Home.

I must say I do not quite remember how I installed SFML, it was a few months ago, my .cpp file couldn't compile and I gave up. Now I'm trying to make things work again. I'm pretty sure I installed it through "sudo apt-get install" commands though.

If I type:

sudo apt-get install libsfml-dev

I get:

Reading package lists... Done
Building dependency tree      
Reading state information... Done
libsfml-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.

So basically my computer tells me everything is perfect, yet nothing works!
Ok, I see the problem. Ubuntu 12.04 doesn't have SFML 2.1 in it's repositories you can only install SFML 1.6. I would suggest you to upgrade to Ubuntu 14.04 LTS since it has SFML 2.1 in its repositroyes. Ubuntu 14.04 is also faster and you can install newer versions of applications.
Here is how to upgrade: http://www.omgubuntu.co.uk/2014/04/upgrade-ubuntu-14-04-12-04

Basically just write:
sudo update-manager -d
in terminal
Hmm okay, I would have to think about it a bit...

Wouldn't it be simpler if I just added the right repositories ? Would you know what they are, and how to add them?

66
General / Re: Won't compile
« on: July 10, 2014, 09:13:38 pm »
Sorry I meant usr/lib/i386-linux-gnu (this depends if you have 32 or 64bit instalation)

Have you installed SFML via repository? What Linux distribution are you using?
When you are in terminal did you cd to the directory where is your .cpp ?
Also why are you not using IDE like codeblocks?
Nothing there either. I have Ubuntu 12.04 LTS. 64 bits. My .cpp file is located in some random directory in Home.

I must say I do not quite remember how I installed SFML, it was a few months ago, my .cpp file couldn't compile and I gave up. Now I'm trying to make things work again. I'm pretty sure I installed it through "sudo apt-get install" commands though.

If I type:

sudo apt-get install libsfml-dev

I get:

Reading package lists... Done
Building dependency tree      
Reading state information... Done
libsfml-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.

So basically my computer tells me everything is perfect, yet nothing works!

67
General / Re: Won't compile
« on: July 10, 2014, 07:33:36 pm »
What distribution are you using? are you sure that SFML is installed? are you sure SFML is installed in standard path?
You can check if it's installed in standard path by going in /usr/share and check if libsfml-dev is there.
I do not have any libsfml-dev folder in /usr/share/, however /usr/local/lib/ and /usr/local/include/ contain everything they need. So I guess the problem is that libsfml-dev folder missing in /usr/share/. How do I fix this, cleanly?

68
General / Won't compile
« on: July 10, 2014, 06:47:30 pm »
Hello, here is my very simple file SFML.cpp :

#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>

using namespace std;

int main(int argc, char **argv)
{
    sf::RenderWindow Window(sf::VideoMode(800, 600), "My Window :D");
    sf::Texture Sprite;
    Window.clear(sf::Color::Black);
    Window.display();
    return 0;
}

I try to compile it :

g++-4.8 -std=c++11 -o SFML SFML.cpp -Wall -lsfml-graphics -lsfml-window -lsfml-system

And here is what I get :

/tmp/ccg01oFm.o: In function `main':
SFML.cpp:(.text+0x104): undefined reference to `sf::String::String(char const*, std::locale const&)'
SFML.cpp:(.text+0x155): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
SFML.cpp:(.text+0x182): undefined reference to `sf::Texture::Texture()'
SFML.cpp:(.text+0x19a): undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
SFML.cpp:(.text+0x1a9): undefined reference to `sf::Window::display()'
SFML.cpp:(.text+0x1bd): undefined reference to `sf::Texture::~Texture()'
SFML.cpp:(.text+0x212): undefined reference to `sf::Texture::~Texture()'
collect2: error: ld returned 1 exit status

Would you know how to fix this? Thanks.

Pages: 1 ... 3 4 [5]
anything