在声明代码时,我遇到了两个错误 - 未解析的外部符号和1个未解析的外部错误。我看到第一个导致第二个。 'graphics'文件夹位于项目位置:C:\ Users \ cpp_shared \ documents \ visual studio 2015 \ Projects \ TIMBER \ graphics
在Project-> Properties-> Debug-> Linker-> Input中声明的SFML库:sfml-graphics-d.lib; sfml-window-d.lib; sfml-system-d.lib; sfml-network-d.lib; SFML-音频d.lib;
如果有人能帮助我,我会很高兴:)
码:
#include "stdafx.h"
#include <SFML/Graphics.hpp>
//Using SFML namespace
using namespace sf;
int main()
{
//Create VideoMode object 'vm'
VideoMode vm(1920, 1080);
//Create RenderWindow object 'window'
//render 'window' with params
RenderWindow window(vm, "TIMBER", Style::Default);
//Create Texture object 'textureBackground'
Texture textureBackground;
//Load image into the object 'textureBackground'
textureBackground.loadFromFile("graphics/background.png");
//Sprite needs a texture to display itself as an image
//Create Sprite object 'spriteBackground'
Sprite spriteBackground;
//Attach the texture to the Sprite
spriteBackground.setTexture(textureBackground);
//Set spriteBackground to 0x0 position
spriteBackground.setPosition(0, 0);
//Close the window by pressing ESC
while (window.isOpen())
{
if (Keyboard::isKeyPressed(Keyboard::Escape)) {
window.close();
}
}
//Clear the window before rendering new frame
window.clear();
//Draw spriteBackground
window.draw(spriteBackground);
//End current frame and display it
window.display();
return 0;
}
错误:
错误LNK2001未解析的外部符号“public:static class sf :: RenderStates const sf :: RenderStates :: Default”(?Default @ RenderStates @sf @@ 2V12 @ B)
错误LNK1120 1未解析的外部TIMBER C:\ Users \ cpp_shared \ documents \ visual studio 2015 \ Projects \ TIMBER \ Debug \ TIMBER.exe
好吧,解决方案很明显 - WIN10 Enterprise上的VS15使用Host用户凭据来执行程序。一旦ConnectionString更改为AD,程序就能够从存储中读取。