【问题标题】:Changing x86 to x64 affects my LNK1168 Error将 x86 更改为 x64 会影响我的 LNK1168 错误
【发布时间】:2020-02-19 23:51:04
【问题描述】:

所以我使用 Visual Studio 在 C++ 中创建了一个代码,并且我正在学习制作类和使用方法/函数。该程序运行良好,直到我写了using namespace std; 并突然尝试运行我的代码我得到了一个 LNK1168 错误,我尝试了一切来修复它。

我确保没有任何任务在运行,我保存并关闭它并重新打开它以再次运行它,但无论我做什么,LNK1168 错误都会再次弹出。

然后我从调试 x86 切换到调试 x64,我的代码在 x64 上正常工作。

这有关系吗?如果是为什么,如果不是那我该怎么办?

#include<iostream>

// did not include the using namespace std; because that's when my issue started 
// not sure if it had something to do with it

class Player
{
public:
    int x, y;
    int speed;


void movin(int xa, int ya)
{
    x += xa * speed;
    y += ya * speed;
}

};



int main()
{

    Player player;

    player.movin(1, 1);

    std::cout << "apples are tasty";  // this is to make sure my code prints something


    std::cin.get();

    return 0;
}

我尝试查找 youtube 视频,但没有任何帮助!奇怪的是 x64 可以工作,但不是通常的 x86?这会影响我的代码或我如何编译我的代码吗?它会让事情运行得更慢吗?我很困惑。 单击错误后,我尝试查看 Windows 帮助站点,但没有任何帮助。有人知道吗?

【问题讨论】:

  • 你可能会做一些其他的改变。上面在 x86 和 x64 中带有“命名空间 std”语句的代码在 VisualStudio 2019 上成功运行。

标签: c++


【解决方案1】:

LNK1168 表示当您尝试编译代码时您的可执行文件仍在运行。关闭应用,然后编译。

【讨论】:

  • 你是什么意思,就像我退出一切并重新打开我的文件,然后我在 x86 上调试它我得到错误,但当它是 x64 时我没有。如果应用程序是指我的输出窗口,我关闭并编译它仍然出现错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-06
  • 1970-01-01
  • 1970-01-01
  • 2011-02-20
  • 1970-01-01
相关资源
最近更新 更多