1
General / Re: [CMake]Could NOT find SFML
« on: June 23, 2016, 10:44:06 pm »
Can anyone help me, please?
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.
find_package(SFML 2 COMPONENTS system window graphics network audio)
18:56:56: Выполняются этапы для проекта ECS_GameEngine...
18:56:56: Запускается: «/usr/bin/cmake» --build . --target all
Linking CXX executable /home/saitei/Projects/ECS_GameEngine/bin/ECS_GameEngine
CMakeFiles/ECS_GameEngine.dir/main.cpp.o: In function `main':
main.cpp:(.text.startup+0x4b): undefined reference to `sf::String::String(char const*, std::locale const&)'
main.cpp:(.text.startup+0x64): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
main.cpp:(.text.startup+0x87): undefined reference to `sf::Window::Window(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
main.cpp:(.text.startup+0xae): undefined reference to `sf::Window::isOpen() const'
main.cpp:(.text.startup+0xd3): undefined reference to `sf::Window::pollEvent(sf::Event&)'
main.cpp:(.text.startup+0xe1): undefined reference to `sf::Window::display()'
main.cpp:(.text.startup+0xf6): undefined reference to `sf::Window::close()'
main.cpp:(.text.startup+0x102): undefined reference to `sf::Window::~Window()'
main.cpp:(.text.startup+0x13d): undefined reference to `sf::Window::~Window()'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/saitei/Projects/ECS_GameEngine/bin/ECS_GameEngine] Error 1
make[1]: *** [CMakeFiles/ECS_GameEngine.dir/all] Error 2
make: *** [all] Error 2
18:56:56: Процесс «/usr/bin/cmake» завершился с кодом 2.
Ошибка при сборке/установке проекта ECS_GameEngine (комплект: Desktop Qt 5.6.0 GCC 64bit)
Во время выполнения этапа «Сборка»
18:56:56: Прошло времени: 00:00.
cmake_minimum_required(VERSION 2.
project(ECS_GameEngine)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
set(SRC_LIST ${SRC_LIST} main.cpp entity.h component.cpp system.cpp channel.cpp
gamestate.h engine.h)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(SFML_ROOT "${CMAKE_BINARY_DIR}/deps/SFML-2.3.2")
set(SFML_STATIC_LIBRARIES TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/deps/SFML-2.3.2/cmake/Modules")
find_package(SFML 2 COMPONENTS system window graphics network audio)
include_directories(${SFML_INCLUDE_DIR})
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
cmake_minimum_required(VERSION 2.
project(ECS_GameEngine)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
#aux_source_directory(. SRC_LIST)
set(SRC_LIST ${SRC_LIST} main.cpp entity.h component.cpp system.cpp channel.cpp
gamestate.h engine.h)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/deps/SFML-2.3.2/cmake/Modules")
set(SFML_ROOT "${CMAKE_BINARY_DIR}/deps/SFML-2.3.2")
set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2 REQUIRED system window graphics network audio)
if(SFML_FOUND)
include_directories(${SFML_INCLUDE_DIR})
target_link_libraries(${PROJECT_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES})
endif()
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libx11-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libglew1.5-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libsndfile1-dev
sudo apt-get install libopenal-dev
sudo apt-get install cmake
sudo apt-get install g++
/home/saitei/Projects/ECS_GameEngine/deps/SFML-2.3.2/cmake/Modules/FindSFML.cmake:358: ошибка: Could NOT find SFML (missing: SFML_SYSTEM_LIBRARY SFML_WINDOW_LIBRARY SFML_GRAPHICS_LIBRARY SFML_NETWORK_LIBRARY SFML_AUDIO_LIBRARY) CMakeLists.txt:23 (find_package)
Do yourself a favor and forget about threads...
You can paint detail my mistakes? I would be very grateful
- Forget multithreading, you failed at it miserably
- You entirely used mutexts wrong
- None of your concurrently accessed varibles are protected
- Learn how memory management works in C++, you failed again with a memory leak
- 'using' statements at header level aren't good ideas
- Probably other things are wrong, you should really just stick to a single threaded server as already mentioned
But nothing about threads for serverQuoteSince I'm trying to write a chat room for N users, my server must be able to communicate with different clients on TCP. As planned, I was trying to do thread "CheckConnectionsThr": but i really do not understand how to support multiple TCP connections. I would like to allocate stream to each client...The documentation of sf::SocketSelector shows how to accept multiple connections and then manage one socket per client in a selector.QuoteBut... How do I know what socket finished receiving information?Have you read the tutorial and documentation? It's clearly explained, with examples.
I don't know what else to say. We can't teach you how networking works, only how to do it with SFML, and the documentation / tutorials already cover that quite well. You may need to read more articles about generic networking, that explain the concepts of sockets, selectors, etc. before you try to implement something with SFML.
>>>Once connected, a TCP socket can only send and receive to/from the connected socket. So you'll need one TCP >>>socket for each client in your application.This means that one and the same socket works for all clients? Oh... Still, I think in Russian and there are problems with the translation...
Okay, I will try to describe the problem more formally...Quote1)I do not know how to create a lot of TCP connections in many threads.You'll have to be more specific about what your problem is, not what you think you need to solve it.
Once connected, a TCP socket can only send and receive to/from the connected socket. So you'll need one TCP socket for each client in your application.
// the selector will tell you which socket has received data, and you can call "receive" on it directlyBut... How do I know what socket finished receiving information?
If it's still not clear then play with a server that accepts more than 1 client. You'll understand the problem quickly...I'm trying to create a server for more than 1 clients... And I got confused with the TCP.. With 1 client no problems.
The documentation is your friend.When i call method "draw" at RenderTexture - all draws at the texture, when i call method "draw" at RenderWindow - all draw at the window - do I understand correctly?
http://sfml-dev.org/documentation/2.1/classsf_1_1RenderTarget.php#a12417a3bcc245c41d957b29583556f39
http://sfml-dev.org/documentation/2.1/classsf_1_1RenderStates.php#ad29672df29f19ce50c3021d95f2bb062
http://sfml-dev.org/documentation/2.1/group__graphics.php#ga80c52fe2f7050d7f7573b7ed3c995388
Also this forum has a search, I'm 100% certain you'd have found an answer that way as well.
The same way as with a RenderWindow, by applying blend modes.Sorry, more of this will not happen again.
Also use the edit function if you want to add something and nobody has replied yet.