python distutils链接:致命错误LNK1104:无法打开文件'libMySQL.lib库'

2024-09-28 19:03:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用以下代码编译.pyd文件设置.pywindows上的文件 {

setup(name='quickfix',
      version='1.14.3',
      py_modules=['quickfix', 'quickfixt11', 'quickfix40', 'quickfix41', 'quickfix42', 'quickfix43', 'quickfix44', 'quickfix50', 'quickfix50sp1', 'quickfix50sp2'],
      data_files=[('share/quickfix', glob.glob('spec/FIX*.xml'))],
      author='Oren Miller',
      author_email='oren@quickfixengine.org',
      maintainer='Oren Miller',
      maintainer_email='oren@quickfixengine.org',
      description="FIX (Financial Information eXchange) protocol implementation",
      url='http://www.quickfixengine.org',
      download_url='http://www.quickfixengine.org',
      license=license,
      include_dirs=['C++','C:/Program Files (x86)/MySQL/MySQL Server 5.6/include','C:/Program Files (x86)/MySQL/MySQL Server 5.6/lib'],
      #library_dirs=['C:/Program Files/MySQL/MySQL Server 5.6/lib'],
      #cmdclass = {'build_ext': build_ext_subclass },
      ext_modules=[Extension('_quickfix', glob.glob('C++/*.cpp'), libraries=['Ws2_32', 'odbc32', 'odbccp32'], extra_compile_args=['/EHsc', '/DHAVE_STD_TR1_SHARED_PTR'])],
)

}

我得到这个错误: {

^{pr2}$

}

有什么办法解决这个问题吗?如何创建对libMySQL.lib?在

谢谢


Tags: 文件orgmodulesserverlibmysqlfilesprogram
1条回答
网友
1楼 · 发布于 2024-09-28 19:03:02

我最终包括了libmysql.lib库以及libmysql.dll文件位于与设置.py文件似乎已经解决了错误,但现在我有了一个新的文件(可能与..):

MySQLStore.obj : error LNK2019: unresolved external symbol _strptime referenced in function "private: void __thiscall FIX::MySQLStore::populateCache(void)" (?populateCache@MySQLStore@FIX@@AAEXXZ)
build\lib.win32-2.7\_quickfix.pyd : fatal error LNK1120: 1 unresolved externals
error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\link.exe' failed with exit status 1120

MySQLStore.h:

^{pr2}$

以下是我认为MySQLStore.cpp在

^{3}$

…和。。在

void MySQLStore::populateCache()
{
  std::stringstream queryString;

  queryString << "SELECT creation_time, incoming_seqnum, outgoing_seqnum FROM sessions WHERE "
  << "beginstring=" << "\"" << m_sessionID.getBeginString().getValue() << "\" and "
  << "sendercompid=" << "\"" << m_sessionID.getSenderCompID().getValue() << "\" and "
  << "targetcompid=" << "\"" << m_sessionID.getTargetCompID().getValue() << "\" and "
  << "session_qualifier=" << "\"" << m_sessionID.getSessionQualifier() << "\"";

  MySQLQuery query( queryString.str() );
  if( !m_pConnection->execute(query) )
    throw ConfigError( "No entries found for session in database" );

  int rows = query.rows();
  if( rows > 1 )
    throw ConfigError( "Multiple entries found for session in database" );

  if( rows == 1 )
  {
    struct tm time;
    std::string sqlTime = query.getValue( 0, 0 );
    strptime( sqlTime.c_str(), "%Y-%m-%d %H:%M:%S", &time );
    m_cache.setCreationTime (UtcTimeStamp (&time));
    m_cache.setNextTargetMsgSeqNum( atol( query.getValue( 0, 1 ) ) );
    m_cache.setNextSenderMsgSeqNum( atol( query.getValue( 0, 2 ) ) );
  }

文件SrpTime.h在“C++”文件夹中,因此应该包含在…在

#ifdef _MSC_VER
extern "C"
  char *
  strptime( const char *buf, const char *fmt, struct tm *tm );

#endif

有什么想法吗? 非常感谢

相关问题 更多 >