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 - genfy

Pages: [1]
1
General / SFML & cmake error
« on: May 22, 2018, 09:31:42 pm »
I can run cmake just fine but when I go to make the project I get this error:
CMakeFiles/RogueLike.dir/src/Main.cpp.o: In function `main':
Main.cpp:(.text+0x75): undefined reference to `sf::String::String(char const*, std::locale const&)'  
Main.cpp:(.text+0x93): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'  
Main.cpp:(.text+0xc6): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'  
Main.cpp:(.text+0xf3): undefined reference to `sf::Window::isOpen() const'      
Main.cpp:(.text+0x110): undefined reference to `sf::Window::pollEvent(sf::Event&)'  
Main.cpp:(.text+0x12d): undefined reference to `sf::Window::close()'    
Main.cpp:(.text+0x13e): undefined reference to `sf::RenderWindow::~RenderWindow()'
Main.cpp:(.text+0x17a): undefined reference to `sf::RenderWindow::~RenderWindow()'  
Main.cpp:(.text+0x1ab): undefined reference to `sf::RenderWindow::~RenderWindow()'

This is my cmake document:
# TODO add non-linux OS compatibility
# Setup
cmake_minimum_required(VERSION 3.0)
project(RogueLike)

set(CMAKE_MODULE_PATH /usr/share/SFML/cmake/Modules)

# Libraries
# set(SFML_STATIC_LIBRARIES TRUE)
find_package(SFML 2 COMPONENTS audio graphics window system)
if(SFML_FOUND)
        include_directories(${SFML_INCLUDE_DIR})
endif()

# Source
set(src
        src/Main.cpp
)

# Generate executable
add_executable(RogueLike ${src})

And finally my code:
#include<SFML/Graphics.hpp>

int main() {
        sf::RenderWindow window(sf::VideoMode(1280, 720), "Hello, world!");

        while(window.isOpen()) {
                sf::Event e;
                while(window.pollEvent(e)) {
                        if(e.type == sf::Event::Closed) {
                                window.close();
                        }
                }
        }
}
 

2
Network / UDP packet returns 0 after unpacketing
« on: February 21, 2017, 01:27:09 am »
std::cout << "Sending the player id: " << c.id << std::endl; //prints 1
packet << ugid << pt::handshake << id;
socket.send(packet, sender, rport);
packet >> c.id >> c.id >> id;
std::cout << id << std::endl; //prints 0

I'm handing my client a unique ID which increments every connect. This is for my first client, the id variable is 1 and I pass it to my packet, but when opening the packet the id variable is 0. I'm using sf::UInt32. I'm opening the packet on the server side, but it is 0 on the client side too.

pt::handshake is an enum = 0.

Here are the links to my full server code:
http://pastebin.com/eChQu6fd
http://pastebin.com/yMTLeHeV

Pages: [1]
anything