Answer the question
In order to leave comments, you need to log in
Link to an unresolved external symbol, what is it and how to fix it?
I made a menu for the game according to the guide on YouTube, but I had a problem in the form of these errors:
#include <SFML/Graphics.hpp>
using namespace sf;
void menu(RenderWindow& window) {
Texture menuTexture1, menuTexture2, menuTexture3, aboutTexture, menuBackground;
menuTexture1.loadFromFile("images/111.png");
menuTexture2.loadFromFile("images/222.png");
menuTexture3.loadFromFile("images/333.png");
aboutTexture.loadFromFile("images/about.png");
menuBackground.loadFromFile("images/Penguins.jpg");
Sprite menu1(menuTexture1), menu2(menuTexture2), menu3(menuTexture3), about(aboutTexture), menuBg(menuBackground);
bool isMenu = 1;
int menuNum = 0;
menu1.setPosition(100, 30);
menu2.setPosition(100, 90);
menu3.setPosition(100, 150);
menuBg.setPosition(345, 0);
//////////////////////////////МЕНЮ///////////////////
while (isMenu)
{
menu1.setColor(Color::White);
menu2.setColor(Color::White);
menu3.setColor(Color::White);
menuNum = 0;
window.clear(Color(129, 181, 221));
if (IntRect(100, 30, 300, 50).contains(Mouse::getPosition(window))) { menu1.setColor(Color::Blue); menuNum = 1; }
if (IntRect(100, 90, 300, 50).contains(Mouse::getPosition(window))) { menu2.setColor(Color::Blue); menuNum = 2; }
if (IntRect(100, 150, 300, 50).contains(Mouse::getPosition(window))) { menu3.setColor(Color::Blue); menuNum = 3; }
if (Mouse::isButtonPressed(Mouse::Left))
{
if (menuNum == 1) isMenu = false;//если нажали первую кнопку, то выходим из меню
if (menuNum == 2) { window.draw(about); window.display(); while (!Keyboard::isKeyPressed(Keyboard::Escape)); }
if (menuNum == 3) { window.close(); isMenu = false; }
}
window.draw(menuBg);
window.draw(menu1);
window.draw(menu2);
window.draw(menu3);
window.display();
}
////////////////////////////////////////////////////
}
Answer the question
In order to leave comments, you need to log in
I think you have created a console application instead of a window one. You can recreate the project and select Win32 Application as a template and place your code in it (I recommend this option), or try changing the subsystem from Console to Windows in the linker settings (most likely, you will also need to manually set the entry point.).
So what kind of error is the problem? You attached the menu code itself as errors :) Have a
look at SFML and Visual Studio , do you have your project set up correctly? In particular, pay attention to Configuration Properties/Linker/Input/Additional Dependencies, you should have either SFML listed there. As an option, instead, in VS you can write like this:
#pragma comment(lib, "sfml-graphics.lib")
#pragma comment(lib, "sfml-window.lib")
#pragma comment(lib, "sfml-system.lib")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question