关于windows环境下QT开发ICE程序无法正确连接类库的解决方法

来源:互联网 发布:圣诞节礼物 知乎 编辑:程序博客网 时间:2024/06/06 07:52

 

在使用QT开发ICE应用的时候,有些人还是会在windows环境的。居然遇到了ld链接错误,在论坛上转了一圈看到有人提出相同问题:http://topic.csdn.net/u/20110408/16/1703cbf9-3a77-42f5-8506-1da8ff6e6651.html?seed=24563544&r=72977941#r_72977941

 

现参考zeroc论坛中2006年的一段讨论:

 

引自:http://www.zeroc.com/forums/help-center/2066-ice-qt-opensource-windows.html

 

#1

Paul Drummond
  • View Profile
  • View Forum Posts
  • Private Message
  • Add as Contact
Paul Drummond is offline Registered User
Name: Paul Drummond
Organization: Iode Software
Project: chat room
Join Date
Jan 2006
Location
Sunderland, UK
Posts
25

Ice & Qt Opensource on Windows

Hi All,

I am trying to compile a project written in Qt4.1 using the open source windows version. The project also uses Ice obviously

The problem is with MinGW (which Qt4.1 uses). When I try to link my project with the MSVC7.1 Ice libraries I get about 10 A4 pages worth of "undefined reference" errors. The same is true if I try to link against the VC6.0 package.

I assume this is a compability problem with using MinGW compiler and linking to a MCVS7.1 library? However, my project also links with the "python" library which itself is compiled with a MSVC compiler (7.1 I think) so why is Ice incompatible?

Oh, I also get the annoying "Only multi-threaded dll's can be built with Ice" message. To get around this I just comment out the relevant code in the config.h file.
Cheers,
Paul Drummond
Software Engineer
Serco Integrated Transport
Developing Traffic Control Subsystem

  • #2
    marc's Avatar
    marc
    • View Profile
    • View Forum Posts
    • Private Message
    • Visit Homepage
    • Add as Contact
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,827
    Quote Originally Posted by Paul Drummond
    Oh, I also get the annoying "Only multi-threaded dll's can be built with Ice" message. To get around this I just comment out the relevant code in the config.h file.
    This warning is there for a reason--don't comment it out! You must use multi-threaded DLLs with Ice, otherwise your application won't work.

    What undefined references do you get? Without seeing the actual link errors, it's hard to tell what's going wrong.

  • #3
    marc's Avatar
    marc
    • View Profile
    • View Forum Posts
    • Private Message
    • Visit Homepage
    • Add as Contact
    marc is offline ZeroC Staff
    Name: Marc Laukien
    Organization: ZeroC, Inc.
    Project: The Internet Communications Engine
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    1,827
    I just looked up MinGW, this seems to be a GCC version for Windows, right? Does this version of GCC have a C++ binary format that is compatible with Visual C++ 6.0 or 7.1? If not, then you cannot use MinGW together with Visual C++ libraries. Instead, you would have to try to compile Ice using MinGW from the sources. Unfortunately, we cannot be of any assistance with this, as we do not support GCC on Windows.

    Quote Originally Posted by Paul Drummond
    I assume this is a compability problem with using MinGW compiler and linking to a MCVS7.1 library? However, my project also links with the "python" library which itself is compiled with a MSVC compiler (7.1 I think) so why is Ice incompatible?
    Ice is a C++ application, while Python is written in C only. The C binary APIs of different compilers are usually compatible, but the C++ binary APIs are usually not.
    Last edited by marc; 01-31-2006 at 07:18 AM.

  • #4
    Paul Drummond
    • View Profile
    • View Forum Posts
    • Private Message
    • Add as Contact
    Paul Drummond is offline Registered User
    Name: Paul Drummond
    Organization: Iode Software
    Project: chat room
    Join Date
    Jan 2006
    Location
    Sunderland, UK
    Posts
    25
    Quote Originally Posted by marc
    This warning is there for a reason--don't comment it out! You must use multi-threaded DLLs with Ice, otherwise your application won't work.
    My project does use multi-threaded libraries - it just doesn't define _DLL or _MT!

    Quote Originally Posted by marc
    Ice is a C++ application, while Python is written in C only. The C binary APIs of different compilers are usually compatible, but the C++ binary APIs are usually not.
    Thank you for clearing that up - I was confused why Python would link but Ice wouln't - now I know. I forgot Python was C only - silly me!

    So I need to compile Ice using MinGW - how hard can it be ???
    Cheers,
    Paul Drummond
    Software Engineer
    Serco Integrated Transport
    Developing Traffic Control Subsystem
  •  

     

     -------------------------------------------------------

    看得出来ICE并非发布了支持MinGW类库的发布包,要想彻底解决,只能自行编译了。要是想图省事,就换到linux环境下开发去,如果非要在windows环境上,也就只有重新编译这一条路了。:)