0

Yesterday I was playing around with an IRC bot in C++. It compiled and worked just fine, the only thing it really did was say "pong" whenever it saw "ping".

Today I tried to implement a random facts bit of code. I compiled it in cygwin using

g++ -o ircbot.exe main.cpp bot.h bot.cpp

Now when I try to open it, it tells me "Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the file."

After thinking I'd done something wrong I went back, commented out all of the changes I made, tried to compile it again, and it gives the same Windows error. I'm not quite sure where I went wrong here, has anyone had anything similar happen?

Quick update, when I changed the sharing state on Windows to share with homegroup it told me the version I was running was not compatible with my version of Windows and to check whether or not it was in 32-bit or 64-bit. I have no idea what it's up to, this is the strangest issue I've had programming. I'll give it a shot in Linux and see if it pulls any silly business.

4

1 回答 1

0

这在 Linux 上发生在我身上,但是由于您使用的是 cygwin 并且问题非常相似,因此可能是同一件事。

我在 64 位机器上将 C++ 程序编译成 32 位可执行文件。尝试执行给了我“找不到文件”的消息。

结果它失败了,因为我没有我的程序需要的 32 位版本的库。由于某种原因,链接器没有捕捉到它。

尝试传递 -m32 或 -m64,具体取决于您机器的架构。

于 2012-08-16T00:11:47.613 回答