Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Please help]Error  (Read 1571 times)

0 Members and 2 Guests are viewing this topic.

floppa_dev

  • Newbie
  • *
  • Posts: 11
    • View Profile
[Please help]Error
« on: January 15, 2023, 09:07:09 am »
mingw32-make: *** [Makefile:11: run] Error -1073741819
code:
all:run
CC=g++
CFLAGS=-O1 -Wall -std=c++17 -Wno-missing-braces -I ./include/ -L ./lib/ -lsfml-graphics -lsfml-window -lsfml-system
TARGET=floppa.exe
SRC=src/main.cpp
DEPS=src/smth.hpp
$(TARGET): $(SRC) $(DEPS) Makefile
   $(CC) $< -o $@ $(CFLAGS)
build: $(TARGET)
run: build
   ./$(TARGET)
« Last Edit: January 19, 2023, 02:08:27 pm by floppa_dev »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Error
« Reply #1 on: January 16, 2023, 01:03:23 pm »
-1073741819 is 0xC0000005, which will give you a lot of results when searching on the web.

It probably means, that you're using mismatching architectures, i.e. compiling for x64, while using 32-bits SFML libraries.

Also make sure the DLLs are next to your application.
« Last Edit: January 16, 2023, 01:15:06 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

floppa_dev

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Error
« Reply #2 on: January 16, 2023, 02:34:30 pm »
in the same folder or at src/dll? (src is the source folder)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Error
« Reply #3 on: January 16, 2023, 03:39:03 pm »
Next to your executable
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

floppa_dev

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Error
« Reply #4 on: January 16, 2023, 03:51:06 pm »
.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Error
« Reply #5 on: January 16, 2023, 04:19:48 pm »
You can't have the dlls in a directory called dll, but the have to be next to, meaning in the same directory, as your executable (the thing ending in .exe). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

floppa_dev

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Error
« Reply #6 on: January 17, 2023, 03:41:36 pm »
didnt helped
heres the full code:
main.cpp
// Comp issues win any rez other tham 1920*1080
#include "smth.hpp"
using namespace sf;
void display_smth(Object &object, RenderWindow &window)
{
    object.sprite.setPosition(object.position);
    window.draw(object.sprite);
}
int main()
{
    Object player = {{960, 540}, 0}, bg{{1000, 1000}, 0}, bullet{{0, 0}, 0};
    if (!player.texture.loadFromFile("Images/big-floppa-player.png") || !bg.texture.loadFromFile("Images/bg.jpg"))
    {
        return -1;
    }
    //   grass.texture.loadFromFile("Images/grass.png");
    //  grass.sprite.setTexture(grass.texture);
    player.sprite.setOrigin(player.sprite.getTexture()->getSize().x * player.sprite.getScale().x / 2, player.sprite.getTexture()->getSize().y * player.sprite.getScale().y / 2);
    bg.sprite.setTexture(bg.texture);
    RenderWindow window(sf::VideoMode(500, 500), "Super Floppa", Style::Fullscreen);
    while (window.isOpen())
    {
        Event event;
        // bg.sprite.setScale(VideoMode::getDesktopMode()/bg.sprite.getTexture()->getSize().x);
        bg.sprite.setScale(window.getSize().x / bg.sprite.getTexture()->getSize().x, window.getSize().y / bg.sprite.getTexture()->getSize().y);
        while (window.pollEvent(event))
        {
            if (event.type == Event::Closed || Mouse::isButtonPressed(Mouse::Right))
                window.close();
            //  moveObject(object, 10, 45); <-bullet

            if (Keyboard::isKeyPressed(Keyboard::A))
                player.position += {-10.f, 0.f};
            if (Keyboard::isKeyPressed(Keyboard::D))
                player.position += {10.f, 0.f};
            if (Keyboard::isKeyPressed(Keyboard::W))
                player.position += {0.f, -10.f};
            if (Keyboard::isKeyPressed(Keyboard::S))
                player.position += {0.f, 10.f};

            window.draw(bg.sprite);
            display_smth(player, window);
            display_smth(bullet, window);
            /* for (int i = 1; i <= window.getSize().y / 100; i++)
            {
                grass.position = {int(window.getSize().x) + 100 * i, 0};
                display_smth(grass, window);
            }
            */

            window.display();
            window.clear();
            //     if (!bullet.sprite.getGlobalBounds().intersects.bg.getGlobalBounds())
            //     update_pos(bullet, player);
        }
    }
    // std::cout << window.getSize().x / bg.sprite.getTexture()->getSize().x;
    return 0;
}
smth.hpp
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <iostream>
#include <cmath>
const double PI = 3.14159265358979323846;
struct Object
{
    sf::Vector2f position;
    float angle;
    sf::Sprite sprite;
    sf::Texture texture;
} grass;

void update_pos(Object &object1, Object &object2)
{
    object1.position = object2.position;
}
void moveObject_angle(Object &object, float &distance, float &angle)
{
    // Calculate the displacement in the x and y directions
    float dx = distance * cos(angle * PI / 180.0f);
    float dy = distance * sin(angle * PI / 180.0f);

    // Update the object&#39;s position
    object.position.x += dx;
    object.position.y += dy;

    // Update the object&#39;s sprite position
    object.sprite.setPosition(object.position);
}
/*bool jump(int f)
{
    int o = f;
    f-= o/10;
    player.position += player.position += {0.f, f};
    if(player.getGlobalBounds.itersects.grass.sprite)
    return 0;
}*/
plsssss
« Last Edit: January 18, 2023, 01:32:46 pm by floppa_dev »

 

anything