SFML community forums
Help => General => Topic started by: Salepate 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/ :
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:
# 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
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:
#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 :
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?
-
i still get those warnings.
Which ones ?
-
In fact, i haven't been fixing anything at all, it just happened to work on another Mac Os X.
the warnings i keep gettings are those like
linker input file unused because linking not done
and, no matter the way I build SFML libs, I won't be able to compile any project that use them, i can't get rid of the undefined symbols errors
Undefined symbols for architecture x86_64:
Edit: It seems like someone else has the same errors, i might find what I need here
http://www.sfml-dev.org/forum/viewtopic.php?t=6162
I'll keep you informed
-
These two posts are not related.
You're doing the compilation wrong. Instead to give the linker optionS to your compiler when compiling the two source files you should pass these options when "merging" the object files together.
-
These two posts are not related.
You're doing the compilation wrong. Instead to give the linker optionS to your compiler when compiling the two source files you should pass these options when "merging" the object files together.
Yeah, i'd fixed that. .
Right now, i'm still getting the "undefined symbols for architecture" error message, that's if I don't give options
-lsfml-graphics -lsfml-window -lsfml-system
when merging object files together. (these options wont let it work saying that library -lsfml-graphics wasn't found)
And here's my current Makefile
# Tools
CXX= g++
CFLAGS= -Wall -ansi
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)) $(CFLAGS) $(CLIBS)
%.o: %.cpp
@echo "\033[32mbuilding $@ ($<)\033[0m"
@mkdir -p obj
$(CXX) -o $(OBJDIR)$@ -c $< $(CFLAGS) -I$(INCDIR)
# Cleaning !
.PHONY: clean cleanall
clean:
rm -rf $(OBJDIR)
cleanall: clean
rm -f $(BIN)
Might I be missing something ?
-
You haven't installed SFML properly. Or, you forget the "-L/Users/Willy/Dev/SFML/lib/" part in your new Makefile.
-
Hu? I proceeded to make install (with sudo), do I really need to check that folder too?
I'll start from scratch again and report here when I'm done