我需要使用为x86,x64和IA64制作的Windows可执行文件.我想通过检查文件本身以编程方式找出平台.
我的目标语言是PowerShell,但C#示例可以.如果您知道所需的逻辑很好,那么其中任何一个都会失败.
我正在尝试在Visual Studio 2013上用C++构建这个简单的ZeroMQ服务器.
#include "stdafx.h"
#include "zmq.hpp"
#include <string>
#include <iostream>
#include <windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Prepare context and socket
zmq::context_t ctx(1);
zmq::socket_t sckt(ctx, ZMQ_REP);
sckt.bind("tcp://*:5555");
while (true) {
zmq::message_t request;
// Wait for next request from client
sckt.recv(&request);
std::cout << "Received Hello" << endl;
Sleep(1);
// Send reply back to client
zmq::message_t reply(5);
memcpy((void*)reply.data(), "World", 5);
sckt.send(reply);
}
return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试构建VS项目时,我收到错误LNK2019.下面是编译器输出:
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_errno referenced in …Run Code Online (Sandbox Code Playgroud)