VS15:错误LNK2001:未解析的外部符号

时间:2018-03-01 13:57:08

标签: c++ lnk2001

在声明代码时,我遇到了两个错误 - 未解析的外部符号和1个未解析的外部错误。我看到第一个导致第二个。 'graphics'文件夹位于Project Location中: C:\ Users \ cpp_shared \ documents \ visual studio 2015 \ Projects \ TIMBER \ graphics

在Project-> Properties-> Debug-> Linker->中声明的SFML库输入: SFML-图形d.lib; SFML窗口-d.lib; SFML系统-d.lib; SFML-网络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

1 个答案:

答案 0 :(得分:0)

嗯,解决方案很明显 - WIN10 Enterprise上的VS15使用Host用户凭据来执行程序。一旦ConnectionString更改为AD,程序就能够从存储中读取。