VS15: error LNK2001: 未解析的外部符号
VS15: error LNK2001: unresolved external symbol
在声明代码时,我遇到了两个错误 - 未解析的外部符号和 1 个未解析的外部符号。我看到第一个导致第二个。
'graphics' 文件夹位于项目位置:
C:\Users\cpp_shared\documents\visual工作室2015\Projects\TIMBER\graphics
在项目->属性->调试->链接器->输入中声明的 SFML 库:
sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-network-d.lib;sfml-audio-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;
}
错误:
Error LNK2001 unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
Error LNK1120 1 unresolved externals TIMBER C:\Users\cpp_shared\documents\visual studio 2015\Projects\TIMBER\Debug\TIMBER.exe
好吧,解决方案很明显 - WIN10 Enterprise 上的 VS15 使用主机用户凭据来执行程序。一旦 ConnectionString 更改为 AD,程序就能够从存储中读取。
在声明代码时,我遇到了两个错误 - 未解析的外部符号和 1 个未解析的外部符号。我看到第一个导致第二个。 'graphics' 文件夹位于项目位置: C:\Users\cpp_shared\documents\visual工作室2015\Projects\TIMBER\graphics
在项目->属性->调试->链接器->输入中声明的 SFML 库: sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-network-d.lib;sfml-audio-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;
}
错误:
Error LNK2001 unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)
Error LNK1120 1 unresolved externals TIMBER C:\Users\cpp_shared\documents\visual studio 2015\Projects\TIMBER\Debug\TIMBER.exe
好吧,解决方案很明显 - WIN10 Enterprise 上的 VS15 使用主机用户凭据来执行程序。一旦 ConnectionString 更改为 AD,程序就能够从存储中读取。