Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoJSONGeometry::get()の実装が隠れている #933

Closed
sthairno opened this issue Dec 31, 2022 · 1 comment
Closed

GeoJSONGeometry::get()の実装が隠れている #933

sthairno opened this issue Dec 31, 2022 · 1 comment

Comments

@sthairno
Copy link
Member

エラーの内容 | Describe the build error

GeoJSONGeometry::get()の実装がヘッダに書かれておらず、使おうとするとリンクエラーになります。

/// @brief 形状データを取得します。
/// @tparam Type 形状データの型
/// @return 形状データ
template <class Type>
[[nodiscard]]
Type get() const;

再現方法 | To Reproduce

テストコード

# include <Siv3D.hpp> // OpenSiv3D v0.6.6

void Main()
{
	GeoJSONGeometry geometry(JSON::Parse(UR"(
	{
		"type": "Point",
		"coordinates" : [1, 2]
	})"));

	Print << geometry.get<Point>();

	while (System::Update())
	{ }
}

ビルド時ログ

1>------ Build started: Project: tmp_Siv3D, Configuration: Debug x64 ------
1>   Creating library C:\Users\sthai\source\repos\tmp_Siv3D\Intermediate\tmp_Siv3D\Debug\tmp_Siv3D(debug).lib and object C:\Users\sthai\source\repos\tmp_Siv3D\Intermediate\tmp_Siv3D\Debug\tmp_Siv3D(debug).exp
1>Main.obj : error LNK2019: unresolved external symbol "public: struct s3d::Point __cdecl s3d::GeoJSONGeometry::get<struct s3d::Point>(void)const " (??$get@UPoint@s3d@@@GeoJSONGeometry@s3d@@QEBA?AUPoint@1@XZ) referenced in function "void __cdecl Main(void)" (?Main@@YAXXZ)
1>C:\Users\sthai\source\repos\tmp_Siv3D\Intermediate\tmp_Siv3D\Debug\tmp_Siv3D(debug).exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "tmp_Siv3D.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Elapsed 00:10.715 ==========

ビルド環境 | Develop environment (please complete the following information):

  • OS: Windows 10
  • 開発環境 | IDE: Visual Studio 2022

備考 | Additional context

https://discord.com/channels/443310697397354506/1000291580915232879/1058064354513260587

@Reputeless
Copy link
Member

テストコードを修正します。
get<Point>() は使えないので get<Vec2>() に。

# include <Siv3D.hpp> // OpenSiv3D v0.6.6

void Main()
{
	GeoJSONGeometry geometry{ JSON::Parse(UR"(
	{
		"type": "Point",
		"coordinates" : [1, 2]
	})") };

	Print << geometry.get<Vec2>(); // (1, -2), Y は反転

	while (System::Update())
	{

	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants