におけるネームスペースの機能を使用する場合、私はProject\test\compare_structs.h
内部関数宣言と名前空間を持っている:のQt - LNK2019クラスのメンバ関数
#ifndef COMPARE_STRUCTS_H
#define COMPARE_STRUCTS_H
#include <QtTest/QtTest>
#include "include/Utils/containers.h"
namespace compare_structs {
void compareRawData(RAW_DATA actual, RAW_DATA expected);
...
}
#endif // COMPARE_STRUCTS_H
IはProject\test\compare_structs.cpp
内部関数を定義:
#include "compare_structs.h"
void compare_structs::compareRawData(RAW_DATA actual, RAW_DATA expected)
{
...
}
Iは.h
と.cpp
ファイルをQts .pro
ファイルに追加しました。
は今、私はクラス.h
にcompare_structs.h
を#include
と.cpp
ファイル内でそれを呼び出す:
Project\test\sql_db_test.h
:
#ifndef SQL_DB_TEST_H
#define SQL_DB_TEST_H
...
#include "test/compare_structs.h"
class Sql_DB_Test : public QObject
{
...
private slots:
...
void add_get_raw_data_test();
...
};
#endif // SQL_DB_TEST_H
Project\main\test\sql_db_test.cpp
:
#include "sql_db_test.h"
void Sql_DB_Test::add_get_raw_data_test()
{
...
compare_structs::compareRawData(rawBack, raw); //LNK2019
}
エラーメッセージ:
sql_db_test.obj:-1: Fehler: LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""void __cdecl compare_structs::compareRawData(struct RAW_DATA,struct RAW_DATA)" ([email protected][email protected]@[email protected]@[email protected])" in Funktion ""private: void __thiscall Sql_DB_Test::add_get_raw_data_test(void)" ([email protected][email protected]@AAEXXZ)".
無料翻訳: unresolved externel symbol ""void __cdecl compare_structs::compareRawData(struct RAW_DATA,struct RAW_DATA)" ([email protected][email protected]@[email protected]@[email protected])" in function ""private: void __thiscall Sql_DB_Test::add_get_raw_data_test(void)" ([email protected][email protected]@AAEXXZ)".
リンカエラーの原因は何?
リンカーエラーのテキストは何ですか? –
@PhilBrubaker私はそれを追加しました。 – goulashsoup
'sql_db_test。*'ファイルは '.pro'ファイルの一部でもありますか? –