私はいくつかのネットワーク関連のコード、特にSFMLを使用するポートスキャナを記述しようとしています。私は人々が、これは試してみて、ライブラリが動作しているかどうかを確認するために、これまでに2017年SFML 2.4.2 SFMLの2015ビルドを使用するVisual C++ 2017用
私のデモコードで動作するべきであると述べているしかし2015用にビルドVS 2017を実行していますし、SFMLをダウンロードしたある:
#include <iostream>
#include <SFML/Network.hpp>
#include <string>
using namespace std;
bool port_is_open(const string& address, int port) {
sf::TcpSocket socket;
bool open = (socket.connect(sf::IpAddress(address), port) == sf::Socket::Done);
socket.disconnect();
return open;
}
int main() {
cout << "Enter IP number: ";
string address;
cin >> address;
cout << "Enter Port number: ";
int port;
cin >> port;
if (port_is_open(address, port)) {
cout << "Port " << port << ": OPEN" << endl;
}
else {
cout << "Port " << port << ": CLOSED" << endl;
}
return 0;
}
しかし、これが働いていれば私はここにはいません。
重大度コード説明プロジェクトファイルの行の抑制状態 エラーLNK2019未解決の外部シンボル "パブリック:仮想__thiscall SF ::ソケット::〜ソケット(無効)"(?? 1Socket @ SF @@ UAE @ XZ)は、参照します関数 "public:virtual __thiscall sf :: TcpSocket ::〜TcpSocket(void)"(1TcpSocket @ sf @@ UAE @ XZ)PortScannerWin32 c:\ Users \ James \ documents \ visualスタジオ2017 \ Projects \ PortScannerWin32 \ PortScannerWin32 \ PortScanner.obj 1
エラーLNK2019未解決の外部シンボル "パブリック:__thiscall SF :: TcpSocket :: TcpSocket(無効)"(?? 0TcpSocket @ SF @@ QAEする@ XZ)関数で参照「BOOL __cdecl port_is_open(クラスstd :: basic_string、クラスstd :: allocator> const & 、int) "(?port_is_open @@ YA_NABV?$ basic_string @ DU?$ char_traits @D @ std @@ V?$ allocator @D @ 2 @@ std @@ H @ Z)PortScannerWin32 c:\ Users \ James \ documents \ visual studio 2017 \ Projects \ PortScannerWin32 \ PortScannerWin32 \ PortScanner.obj 1
エラーLNK2019未解決の外部シンボル "public:enum sf :: Socket :: Status __thiscall sf :: TcpSocket :: connect(class sf :: IpAddress const関数 "bool __cdecl port_is_open(class std)で参照されている@ TcpSocket @ sf @@ QAE?AW4Status @ Socket @ 2 @AVIVIAddress @ 2 @ GVTime @ 2 @@ Z) :: basic_string、クラスstd :: allocator> const &、int) "(?port_is_open @@ YA_NABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @D @ 2 @@ std @@ H @Z)PortScannerWin32 c:¥Users¥James¥documents¥visual studio 2017¥Projects¥PortScannerWin32¥PortScannerWin32¥PortScanner.obj 1
エラーLNK2019未解決の外部シンボル "bool __cdecl port_is_open(class std :: basic_string、TcpSocket :: default_string、クラスのstd :: allocator> const &、int) "(?port_is_open @@ YA_NABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @D @ 2 @@ std @@ H @ Z)PortScannerWin32 c:¥Users¥James¥documents¥visual studio 2017¥Projects¥PortScannerWin32¥PortScannerWin32¥PortScanner.obj 1
エラーLNK2019未解決の外部シンボル "public:__thiscall sf :: IpAddress :: IpAddress(class std :: basic_string、クラスstd :: allocator> const &) "(?? 0IpAddress @ sf @@ QAE @ ABV?$ basic_string @ DU?char_traits @ D @ std @@ V?$ allocator @D @ 2 @ std @@@ Z )関数 "bool __cdで参照される(デフォルトでは、クラスstd :: allocator> const &、int) "と書かれています。 @ std @@ H @ Z)PortScannerWin32 c:\ Users \ James \ documents \ visualスタジオ2017 \ Projects \ PortScannerWin32 \ PortScannerWin32 \ PortScanner.obj 1
エラーLNK2001未解決の外部シンボル「public:static class sf :: Timeポートスキャン・ウィンターズ・オブ・ザ・ナショナル・インフォメーション・マネジメント・ジャパン株式会社(本社:東京都渋谷区、代表取締役社長:ライブラリマシンタイプ 'x64'はターゲットマシンタイプ 'X86'と競合します。PortScannerWin32 D:¥SFML-2.4.2¥lib¥sfml-network-d.lib 1
エラーLNK1120未解決の外部6 PortScannerWin32 c:¥users¥james¥documents¥visual studio 2017¥Projects¥PortScannerWin32¥Debug¥PortScannerWin32。exe 1
これは私のエラーです。私が正直であれば、文字通り全く手がかりがありません。私はチュートリアルの単語を単語に従って、依存関係などを入力しました。
何が問題になっているのでしょうか?私は明らかな答えはVS2017で使用されている2015ですが、SFML 2015にこれを許可するアップデートがあったため、多くのフォーラムが問題なく動作していると言いました。
ライブラリーをリンクしていないようです。 – Sneftel
リンカー - >一般私はD:\ SFML-2.4.2 \ libで追加のライブラリディレクトリを記入しましたが、それはリンクされていませんか?私は依存関係をタイプしました。他に何かしなければならないことがありますか? – toiletduck123
[定義されていない参照/未解決の外部シンボルエラーとは何ですか?どうすれば解決できますか?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-シンボル・エラー・アンド・ハウ・ド・イ・フィックス) – Sneftel