我正在尝试获取一些用 C++ 编写的功能,以便与位于 Linux 机器上的 Apache ActiveMQ(它 native 使用 JMS)进行通信。为了建立这种联系,我尝试在我的 Windows 7 机器(开发机器)上设置 Apache ActiveMQ-CPP,但我目前面临一些主要问题。
据我所知,ActiveMQ-CPP 依赖于 Apache Portable Runtime/APR,如 here 所述.我的问题是,我什至无法构建 APR,因此无法开始使用 ActiveMQ-CPP。我关注了this guide从字面上看,在并行目录中设置,将版本名称重命名为标准名称并将启动项目更改为 libaprutil(使用动态库),但没有任何运气。在构建 APR 解决方案时,27 个项目中只有 13 个成功。我还尝试使用静态 aprutil 项目作为启动项目构建解决方案,但没有任何改进。
解决方案是为了确保为 Visual Studio 6 提供更广泛的兼容性,因此我怀疑使用 Visual Studio 2010 是造成我的问题的原因。尽管升级项目应该是可能的(如 APR 文档所述),但在使用升级助手并尝试构建整个解决方案之后,我在项目中有几个(我认为是)缺少依赖项,请参阅第一个屏幕转储。许多错误与 iconv_module.obj 文件有关(error LNK2019: unresolved external symbol xxx referenced in function _iconv_getpath C:\work\apr-iconv\iconv_module.obj),如下所示工具提示应该在 C:\work\apr-iconv 中找到。该文件实际上位于不同的子文件夹中,具体取决于构建格式(我选择了“Release”和“Win32”),但我不确定这是否真的是一个问题。
我应该提一下,我是 C++ 的新手,对 C 的经验非常有限,所以也许这只是我不明白手动链接的依赖关系……如果打开提到的文件并查看错误消息中说明的功能,但是,代码显然也有问题,所以可能不是依赖项,请参见两个屏幕转储。
关于可能的解决方案,有人建议我尝试手动构建每个项目,而不是一次构建整个解决方案,因此首先构建不依赖于任何东西的库,依此类推。然而,这也没有成功。
也应该可以使用命令行来构建项目,这对某些人来说已经成功了(link)。在较新版本的 Visual Studio 中,“msdev”似乎已被“devenv”取代,但尽管考虑到这一点,构建仍然会在使用查找和替换后提示“找不到 msdev”……也许不是最好的解决方法,对吗?
在搜索有类似问题的帖子时,我肯定不是唯一一个,但不幸的是,没有一个建议的解决方案对我有用。我看过的一些帖子是:Compile Apache APR on Windows和 ActiveMQ-CPP and Visual Studio 2003 .
你们中有人有过使用较新版本的 Visual Studio 或 Windows 上的命令行构建 APR 的经验吗?或者更重要的是,让 ActiveMQ-CPP 在 Windows 上运行?
截图:
最佳答案
我能够使用 ActiveMQ 源代码中 README.txt 中的说明通过命令行构建 APR。
6.2.1 APR library.
APR is provided in source form only from the Apache Software Foundation. You will need to build a library from source by downloading the latest release from:
http://apr.apache.org/At the time of this writing the latest version was v1.5.2 and is recommended since its build support files are working with the Visual Studio 2010 tools.
APR is built from the command line using its provided Make files. When building the library you need to ensure you are in the right environment to produce the desired architecture builds (x64 or win32). You can open a command line that's correct by using the shortcuts under the Visual Studio start menu location (ex. Visual Studio 2010 / Visual Studio Tools / Visual Studio x64 win 64 Command Prompt
Once you are in the proper command prompt change to the directory where your APR source code is located (ex: C:\APR) and then run the build for the library to produce the desired ARCH build.
For a 32 bit library which installs into a proper distribution directory run:
nmake -f Makefile.win ARCH="Win32 Release" PREFIX=C:\dist\APR\x64 buildall install cleanand for a 64 bit build of the library use the command.
nmake -f Makefile.win ARCH="x64 Release" PREFIX=C:\dist\APR\x64 buildall install clean
我做到了:
转到:开始菜单 > 所有程序 > Visual Studio 2017 > Visual Studio 工具
并启动开发者命令提示符。从那里导航到 APR 源的位置并运行适当的命令。在 64 位 Windows 7 上,我运行了 nmake -f Makefile.win ARCH="Win32 Release" PREFIX=C:\dist\APR\x64 buildall install clean
更通用:
转到:开始菜单 > 所有程序 > Visual Studio 2017 > Visual Studio 工具 > VC 并启动您正在构建的体系结构的命令提示符。然后使用 nmake -f Makefile.win ARCH="x64 Release" PREFIX=C:\dist\APR\x64 buildall install clean 继续上述步骤如果为 x64 架构构建。
这成功构建了 APR 并将其放入 C:\dist\APR\x64
然后在 Visual Studio 中确保 C:\dist\APR\x64\includes在项目属性的附加包含中链接。
此时构建会产生以下错误(请参阅下面的解决方案):
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2039: 'auto_ptr': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\sstream(13): note: see declaration of 'std'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2143: syntax error: missing ';' before '<'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(53): error C2238: unexpected token(s) preceding ';'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(55): error C2614: 'decaf::internal::security::SRNGData': illegal member initialization: 'random' is not a base or member
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(74): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(74): error C2228: left of '.reset' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(96): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(96): error C2228: left of '.get' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(99): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(99): error C2227: left of '->setSeed' must point to class/struct/union/generic type
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(117): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(117): error C2228: left of '.get' must have class/struct/union
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(140): error C2039: 'random': is not a member of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(45): note: see declaration of 'decaf::internal::security::SRNGData'
1>..\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp(140): error C2227: left of '->nextBytes' must point to class/struct/union/generic type
解决错误编辑activemq-cpp-library-3.9.4\src\main\decaf\internal\security\windows\SecureRandomImpl.cpp通过添加 #include <memory>在文件的顶部。
添加上述内容后重建包括成功构建 ActiveMQ。
输出到:activemq-cpp-library-3.9.4\vs2010-build\\Win32\Release\libactivemq-cpp.lib
关于c++ - 如何在 Windows 上构建 Apache ActiveMQ-CPP(和 APR)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43409419/
出于纯粹的兴趣,我很好奇如何按顺序创建PI,而不是在过程结果之后生成数字,而是让数字在过程本身生成时显示。如果是这种情况,那么数字可以自行产生,我可以对以前看到的数字实现垃圾收集,从而创建一个无限系列。结果只是在Pi系列之后每秒生成一个数字。这是我通过互联网筛选的结果:这是流行的计算机友好算法,类机器算法:defarccot(x,unity)xpow=unity/xn=1sign=1sum=0loopdoterm=xpow/nbreakifterm==0sum+=sign*(xpow/n)xpow/=x*xn+=2sign=-signendsumenddefcalc_pi(digits
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
如何在buildr项目中使用Ruby?我在很多不同的项目中使用过Ruby、JRuby、Java和Clojure。我目前正在使用我的标准Ruby开发一个模拟应用程序,我想尝试使用Clojure后端(我确实喜欢功能代码)以及JRubygui和测试套件。我还可以看到在未来的不同项目中使用Scala作为后端。我想我要为我的项目尝试一下buildr(http://buildr.apache.org/),但我注意到buildr似乎没有设置为在项目中使用JRuby代码本身!这看起来有点傻,因为该工具旨在统一通用的JVM语言并且是在ruby中构建的。除了将输出的jar包含在一个独特的、仅限ruby
我正在使用的第三方API的文档状态:"[O]urAPIonlyacceptspaddedBase64encodedstrings."什么是“填充的Base64编码字符串”以及如何在Ruby中生成它们。下面的代码是我第一次尝试创建转换为Base64的JSON格式数据。xa=Base64.encode64(a.to_json) 最佳答案 他们说的padding其实就是Base64本身的一部分。它是末尾的“=”和“==”。Base64将3个字节的数据包编码为4个编码字符。所以如果你的输入数据有长度n和n%3=1=>"=="末尾用于填充n%
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
鉴于我有以下迁移:Sequel.migrationdoupdoalter_table:usersdoadd_column:is_admin,:default=>falseend#SequelrunsaDESCRIBEtablestatement,whenthemodelisloaded.#Atthispoint,itdoesnotknowthatusershaveais_adminflag.#Soitfails.@user=User.find(:email=>"admin@fancy-startup.example")@user.is_admin=true@user.save!ende
我正在为一个项目制作一个简单的shell,我希望像在Bash中一样解析参数字符串。foobar"helloworld"fooz应该变成:["foo","bar","helloworld","fooz"]等等。到目前为止,我一直在使用CSV::parse_line,将列分隔符设置为""和.compact输出。问题是我现在必须选择是要支持单引号还是双引号。CSV不支持超过一个分隔符。Python有一个名为shlex的模块:>>>shlex.split("Test'helloworld'foo")['Test','helloworld','foo']>>>shlex.split('Test"
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
这可能是个愚蠢的问题。但是,我是一个新手......你怎么能在交互式rubyshell中有多行代码?好像你只能有一条长线。按回车键运行代码。无论如何我可以在不运行代码的情况下跳到下一行吗?再次抱歉,如果这是一个愚蠢的问题。谢谢。 最佳答案 这是一个例子:2.1.2:053>a=1=>12.1.2:054>b=2=>22.1.2:055>a+b=>32.1.2:056>ifa>b#Thecode‘if..."startsthedefinitionoftheconditionalstatement.2.1.2:057?>puts"f