Qt-interest Archive, May 2007
Re: How to use build and link qt dll using Vistual Studio 2005?
Message 1 in thread
Michael Sprauer åé:
> postbeerliu wrote:
>> 7. app build report
>> ------ Build started: Project: AppTest, Configuration: Debug Win32 ------
>> Linking...
>> E:\PlatformTest\qtvs2005test\LibTest\debug\LibTest.dll : fatal error
>> LNK1107: invalid or corrupt file: cannot read at 0x2C8
>> Build log was saved at
>> "file://e:\PlatformTest\qtvs2005test\AppTest\debug\BuildLog.htm"
>> AppTest - 1 error(s), 0 warning(s)
>> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>>
> Hi there,
>
> if I understand you right you tried to link to a DLL, but it is usually a better idea to
> link to the corresponding .lib
>
> Hope this helps
>
>
Thanks ! First i want to build a library as dll/lib from some .cpp/ .h,
Second I want to use the link my app with given dll or lib. but i fail
in got dll and lib output. i only get dll but no lib found after build.
--
[ signature omitted ]
Message 2 in thread
Hello, postbeerliu
08.05.2007 16:09 you wrote:
> Michael Sprauer åé:
>> postbeerliu wrote:
>>> 7. app build report
>>> ------ Build started: Project: AppTest, Configuration: Debug Win32 ------
>>> Linking...
>>> E:\PlatformTest\qtvs2005test\LibTest\debug\LibTest.dll : fatal error
>>> LNK1107: invalid or corrupt file: cannot read at 0x2C8
>>> Build log was saved at
>>> "file://e:\PlatformTest\qtvs2005test\AppTest\debug\BuildLog.htm"
>>> AppTest - 1 error(s), 0 warning(s)
>>> ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
>>>
>> Hi there,
>>
>> if I understand you right you tried to link to a DLL, but it is usually a better idea to
>> link to the corresponding .lib
>>
>> Hope this helps
>>
>>
> Thanks ! First i want to build a library as dll/lib from some .cpp/ .h,
> Second I want to use the link my app with given dll or lib. but i fail
> in got dll and lib output. i only get dll but no lib found after build.
You should mark your classes as exported by adding __declspec(dllexport)
to declaration
like:
#ifdef WIN32
#ifdef LIB_EXPORTS
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __declspec(dllimport)
#endif
#else
#define LIB_API
#endif
class LIB_API LIB_CLASS
{
...
};
--
[ signature omitted ]