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.


Topics - Salepate

Pages: [1]
1
General / Can't Link SFML 2.0 on Mac OSX 10.7.2
« on: October 30, 2011, 01:17:53 pm »
[updated]

Hey,

i've been trying to make SFML works, but all in vain.

I first tried with the SFML 2.0 snapshot, and then with the SFML git

So here's what i've done:

I retrieved the whole repository. and then used cmake. While doing cmake, the only warnings that i got were about some unbound keycodes. Otherwise it was successful. libs were created in SFML/lib (i tried both static & dynamic libs)
So here's the content of SFML/lib/ :
Code: [Select]

libsfml-audio-s.a libsfml-graphics.dylib libsfml-system.2.dylib
libsfml-audio.2.0.dylib libsfml-network-s.a libsfml-system.dylib
libsfml-audio.2.dylib libsfml-network.2.0.dylib libsfml-window-s.a
libsfml-audio.dylib libsfml-network.2.dylib libsfml-window.2.0.dylib
libsfml-graphics-s.a libsfml-network.dylib libsfml-window.2.dylib
libsfml-graphics.2.0.dylib libsfml-system-s.a libsfml-window.dylib
libsfml-graphics.2.dylib libsfml-system.2.0.dylib


here's what my Makefile project looks like:
Code: [Select]


# Tools
CXX=            g++
CFLAGS=         -Wall -ansi -lsfml-graphics
CLIBS =         -lsfml-graphics -lsfml-window -lsfml-system

# Dirs
SRCDIR=         src/
INCDIR=         include/
OBJDIR=         obj/

# Files
CPPFILES=       $(shell (for f in $$(find ./$(SRCDIR) -type f -name *.cpp); do basename $$f; done;))
OBJFILES=       $(CPPFILES:.cpp=.o)

# Output
BIN=            td610

###############################################################################
# Rules
###############################################################################
vpath   %.cpp $(SRCDIR)

all:    $(OBJFILES)
        $(CXX) -o$(BIN) $(addprefix $(OBJDIR),$(OBJFILES))


%.o:    %.cpp
        @echo "building $@ ($<)"
        @mkdir -p obj
        $(CXX) -o $(OBJDIR)$@ -c $< $(CFLAGS) $(CLIBS) -I$(INCDIR) -L/Users/Willy/Dev/SFML/lib/


And here's the result when I start compiling
Code: [Select]

building game.o (src/game.cpp)
g++ -o obj/game.o -c src/game.cpp -Wall -ansi -lsfml-graphics -lsfml-graphics -lsfml-window -lsfml-system -Iinclude/ -L/Users/Willy/Dev/SFML/lib/
i686-apple-darwin11-llvm-g++-4.2: -lsfml-graphics: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-graphics: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-window: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-system: linker input file unused because linking not done
building main.o (src/main.cpp)
g++ -o obj/main.o -c src/main.cpp -Wall -ansi -lsfml-graphics -lsfml-graphics -lsfml-window -lsfml-system -Iinclude/ -L/Users/Willy/Dev/SFML/lib/
i686-apple-darwin11-llvm-g++-4.2: -lsfml-graphics: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-graphics: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-window: linker input file unused because linking not done
i686-apple-darwin11-llvm-g++-4.2: -lsfml-system: linker input file unused because linking not done
g++ -o td610 obj/game.o obj/main.o
Undefined symbols for architecture x86_64:
  "sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)", referenced from:
      _main in main.o
  "sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::ContextSettings const&)", referenced from:
      _main in main.o
  "sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)", referenced from:
      _main in main.o
  "sf::RenderTarget::Clear(sf::Color const&)", referenced from:
      _main in main.o
  "sf::Window::Display()", referenced from:
      _main in main.o
  "sf::Window::IsOpened() const", referenced from:
      _main in main.o
  "sf::RenderWindow::~RenderWindow()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [all] Error 1


Not to forget my main.cpp:
Code: [Select]

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

using namespace sf;

int main(int argc, char **argv) {
        RenderWindow win( VideoMode(800, 600, 32), "test");
        while ( win.IsOpened() ) {
                win.Clear();
                win.Display();
        }
        return 0;
}                    


I'm not really experienced with Mac stuff, since I do not own any.

I just took a look at the System information and here's what I get :
Code: [Select]

Model Name: MacBook
  Model Identifier: MacBook6,1
  Processor Name: Intel Core 2 Duo
  Processor Speed: 2,26 GHz
  Number of Processors: 1
  Total Number of Cores: 2
  L2 Cache: 3 MB
  Memory: 4 GB
  Bus Speed: 1,07 GHz


I can't tell if it's a 64bits architecture nor a 32bits. I'd say it's a 64 one

Any help would be appreciated,

Salepate

Edit: I just happened to fix the undefined references, it now works but i still get those warnings. might I just ignore it?

2
Graphics / Color problems
« on: October 13, 2010, 01:45:52 pm »
Hey, I've been manipulating Shapes and colors recently and it seems like I don't get something.

When I create my shapes, I always use Color::White, then by using SetColor(), I change its color to the one I want

Code: [Select]

// col is a given parameter : const Color &col
    Color _sColor = col;
    Shape _shape = Shape::Rectangle(0, 0, _size.x, _size.y, Color::White, 1, Color::Black);
    _shape.SetColor(col);


That's working perfectly, but for some unknown reasons, if I try to apply again the same color, it gets darker.

Code: [Select]

_shape.SetColor(_sColor);


I've been double checking what I've done wrong, but I can't see the problem.

Any help would be appreciated, thanks!

Pages: [1]
anything