I am converting an application to use .dlls and I'm riddled with linker errors stating
unersolved external symbol"_开发者_开发百科_declspec(dllimport) public: void __thiscall Rail::SetNextrail(class Rail *)"
There is more gibberish at the end of this error message. Why should this happen and how do you fix it? __declspec(dllimport) is being placed with a macro defined as:
#ifdef LUDOAI_EXPORT
#define DECLSPECAI __declspec(dllexport)
#else
#define DECLSPECAI __declspec(dllimport)
#endif
I believe what you need to do is specify the Rails "import library" to the linker. Using the GUI, this is on the linker tab of project settings, under "additional libraries."
The "import library" is a .LIB file which contains symbols that resolve to the imports of the corresponding library. In the symbols from the .LIB file is an unconditional jump to the imports table's corresponding address for the import. When your code calls an import, it really calls this stub in the import library, which jumps to the import.
I would just like to add, if you are using Qt Creator, this error means you need to add the appropriate import library to your project (.pro) file.
For example:
LIBS += $$quote(C:/Qt/4.7.3/lib/QtXml4.lib)
for debug and release versions.
精彩评论