目标“Valorant.exe”的配方失败

问题描述 投票:0回答:0

你好,我现在在使用 makefile.win 时遇到了很多麻烦,所以每次我尝试运行这段代码时:

#include <SFML/Graphics.hpp>

int main()
{
    // Create a window
    sf::RenderWindow window(sf::VideoMode(800, 600), "Menu Example");

    // Create a font for the text
    sf::Font font;
    font.loadFromFile("arial.ttf");

    // Create a text object for the menu items
    sf::Text item1("Item 1", font, 30);
    item1.setPosition(100, 100);

    sf::Text item2("Item 2", font, 30);
    item2.setPosition(100, 200);

    sf::Text item3("Item 3", font, 30);
    item3.setPosition(100, 300);

    sf::Text item4("Item 4", font, 30);
    item4.setPosition(100, 400);

    // Set the background color
    window.clear(sf::Color::White);

    // Draw the menu items
    window.draw(item1);
    window.draw(item2);
    window.draw(item3);
    window.draw(item4);

    // Display the window
    window.display();

    // Start the game loop
    while (window.isOpen())
    {
        // Handle events
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            else if (event.type == sf::Event::MouseButtonPressed)
            {
                // Check if the mouse is clicked on one of the menu items
                sf::Vector2f mousePos = window.mapPixelToCoords(sf::Mouse::getPosition(window));
                if (item1.getGlobalBounds().contains(mousePos))
                {
                    // Item 1 clicked
                }
                else if (item2.getGlobalBounds().contains(mousePos))
                {
                    // Item 2 clicked
                }
                else if (item3.getGlobalBounds().contains(mousePos))
                {
                    // Item 3 clicked
                }
                else if (item4.getGlobalBounds().contains(mousePos))
                {
                    // Item 4 clicked
                }
            }
        }
    }

    return 0;
}

我收到以下错误:

D:\Moji Projekti\C++\menu\main.o    main.cpp:(.text$_ZN2sf4TextD1Ev[_ZN2sf4TextD1Ev]+0x2b): undefined reference to `__imp__ZTVN2sf4TextE'

D:\Moji Projekti\C++\menu\main.o    main.cpp:(.text$_ZN2sf4TextD1Ev[_ZN2sf4TextD1Ev]+0xe0): undefined reference to `__imp__ZN2sf13TransformableD2Ev'

D:\Moji Projekti\C++\menu\collect2.exe  [Error] ld returned 1 exit status
`26     D:\Moji Projekti\C++\menu\Makefile.win  recipe for target 'Valorant.exe' failed`

我有我的链接器设置:Linkers

目录:directoriesinclude

也将bin粘贴到目录中:files

和sfml的位置:sfml

有人可以帮我吗?

我确实尝试了所有方法,只是继续打开 makefile.win 并将此文本设为红色

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)
c++ makefile
© www.soinside.com 2019 - 2024. All rights reserved.