Answer the question
In order to leave comments, you need to log in
How to connect SFML-2.3.2 to c++ project in VS2015 IDE or CodeBlocks?
I can't connect SFML to the project.
Connected in different ways according to different tutorials.
...I even already learned how to do it :)
windows10 x64
Test code:
#include <SFML/Graphics.hpp>
int main(){
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
return 0;
}
-------------- Build: Debug in sfml_test (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:\c\SFML-2.3.2\lib -LC:\c\SFML-2.3.2\lib -LC:\c\SFML-2.3.2\lib -o bin\Debug\sfml_test.exe obj\Debug\src\main.o -v -static-libgcc -static-libstdc++ -std=c++11 -v -static-libgcc -static-libstdc++ -std=c++11 C:\c\SFML-2.3.2\lib\libsfml-graphics-s.a C:\c\SFML-2.3.2\lib\libsfml-system-s.a C:\c\SFML-2.3.2\lib\libsfml-window-s.a C:\c\SFML-2.3.2\lib\libsfml-graphics-s-d.a C:\c\SFML-2.3.2\lib\libsfml-system-s-d.a C:\c\SFML-2.3.2\lib\libsfml-window-s-d.a -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -mwindows
Using built-in specs.
COLLECT_GCC=mingw32-g++.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-4.9.3/configure --build=x86_64-pc-linux-gnu --host=mingw32 --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --enable-libstdcxx-debug --with-tune=generic --enable-nls
Thread model: win32
gcc version 4.9.3 (GCC)
COMPILER_PATH=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/;c:/mingw/bin/../libexec/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/bin/
LIBRARY_PATH=c:/mingw/bin/../lib/gcc/mingw32/4.9.3/;c:/mingw/bin/../lib/gcc/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib/;c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../
COLLECT_GCC_OPTIONS='-LC:\c\SFML-2.3.2\lib' '-LC:\c\SFML-2.3.2\lib' '-LC:\c\SFML-2.3.2\lib' '-o' 'bin\Debug\sfml_test.exe' '-v' '-static-libgcc' '-std=c++11' '-v' '-static-libgcc' '-std=c++11' '-mwindows' '-mtune=generic' '-march=i586'
c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/collect2.exe -plugin c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/liblto_plugin-0.dll -plugin-opt=c:/mingw/bin/../libexec/gcc/mingw32/4.9.3/lto-wrapper.exe -plugin-opt=-fresolution=C:\Users\USER\AppData\Local\Temp\ccPmQFsm.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lgdi32 -plugin-opt=-pass-through=-lcomdlg32 -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt --subsystem windows -Bdynamic -o bin\Debug\sfml_test.exe c:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../crt2.o c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtbegin.o -LC:\c\SFML-2.3.2\lib -LC:\c\SFML-2.3.2\lib -LC:\c\SFML-2.3.2\lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../../../mingw32/lib -Lc:/mingw/bin/../lib/gcc/mingw32/4.9.3/../../.. obj\Debug\src\main.o C:\c\SFML-2.3.2\lib\libsfml-graphics-s.a C:\c\SFML-2.3.2\lib\libsfml-system-s.a C:\c\SFML-2.3.2\lib\libsfml-window-s.a C:\c\SFML-2.3.2\lib\libsfml-graphics-s-d.a C:\c\SFML-2.3.2\lib\libsfml-system-s-d.a C:\c\SFML-2.3.2\lib\libsfml-window-s-d.a -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d -Bstatic -lstdc++ -Bdynamic -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.9.3/crtend.o
||=== Build: Debug in sfml_test (compiler: GNU GCC Compiler) ===|
obj\Debug\src\main.o||In function `main':|
C:\c\sfml_test\src\main.cpp|4|undefined reference to `sf::String::String(char const*, std::locale const&)'|
C:\c\sfml_test\src\main.cpp|4|undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'|
C:\c\sfml_test\src\main.cpp|4|undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'|
C:\c\sfml_test\src\main.cpp|5|undefined reference to `sf::RenderWindow::~RenderWindow()'|
||error: ld returned 1 exit status|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Серьезность Код Описание Проект Файл Строка
Ошибка LNK2001 неразрешенный внешний символ "__imp_glGetIntegerv" sfml_test2 C:\c\sfml_test2\sfml_test2\sfml_test2\sfml-graphics-s.lib(GLLoader.cpp.obj) 1
Ошибка LNK2001 неразрешенный внешний символ "__imp_glGetError" sfml_test2 C:\c\sfml_test2\sfml_test2\sfml_test2\sfml-graphics-s.lib(GLLoader.cpp.obj) 1
Ошибка LNK2001 неразрешенный внешний символ "__imp_glGetString" sfml_test2 C:\c\sfml_test2\sfml_test2\sfml_test2\sfml-graphics-s.lib(GLLoader.cpp.obj) 1
... ... ...
C:\c\sfml_test2\sfml_test2\sfml_test2\sfml-window-s.lib(WglContext.cpp.obj) 1
Ошибка LNK1120 неразрешенных внешних элементов: 44 sfml_test2 C:\c\sfml_test2\sfml_test2\x64\Release\sfml_test2.exe 1
Answer the question
In order to leave comments, you need to log in
Hooray! I started the project in visual studio!
Just in case, here are the tutorials that helped me:
gamecodeschool.com/sfml/setting-up-visual-studio-a...
gamecodeschool.com/sfml/building-your-first-sfml-g...
I don't know about what was the problem, but I did the following:
All attempts before this I created a new empty project.
And it was necessary to apparently create a "New win32 console application".
Such are the things...
Under codeblock, you need to build your own versions of libraries, since those posted offsite do not fit the compiler in 16.01 (version 4.9.2, 32 bit, SJLJ)
For the studio, they forgot to specify winmm.lib and opengl32.lib: www.sfml-dev.org/ tutorials/2.3/start-vc.php they are listed here in the dependency plate.
Try creating an SFML project in the Code::Blocks environment. All the necessary settings are listed there. And yes, under Code::Blocks (and under MSVS) it is better to build SFML yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question