PDA

View Full Version : use of VC++ code in Qt



shailesh
26th April 2006, 13:56
Hi guys,

Is it possible in anyway to use VC++ code in Qt. I am using VC++ 6 compiler for compiling Qt Application.

I have include afx.h header file. I hav also write this statement: CString str; Then i compiled code and code gets compiled. But the problems r coming during linking. The problem are:

Linking...
uafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in MSVCRT.lib(MSVCRT.dll)

uafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcprt.lib(delop_s.obj)

uafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___wargv
uafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
release/tds_prg.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Reply me as soon as possible.

Thanks in advance.

Regards,
Shail

zlatko
26th April 2006, 14:29
Are you really need that?
Why you dont want use QString insthead ;)

Zatraz
27th April 2006, 04:16
I could be wrong, but it seems that uafxcw.lib library is linked with a C/C++ runtime library and your project is using another one. Try to recompile it with the same one that your project uses. This option could be adjusted in Project Options -> C/C++ Code Generation -> Runtime library.

shailesh
27th April 2006, 12:05
Ok guys

Thanks for your reply. I have resolved that error. The solution is just make the use in dll in Shared dll mode and compile again.

But, still one question : Is it so that any VC++ code can be compiled and linked with Qt project?

wysota
28th April 2006, 12:11
But, still one question : Is it so that any VC++ code can be compiled and linked with Qt project?

There is no such thing as "VC++ code". These are WinAPI (or MFC) calls. Qt is a library like any other. It uses WinAPI internally, so there is no reason not to use other WinAPI calls if you need them.