无法打开文件.exe 1104

use*_*329 1 c++ sfml

我正在使用sfml 2.0.我知道我可以在那里讨论论坛,但我不认为它与链接库有什么关系,因为我编译了一个示例项目很好,而且它几乎完全相同,我只是想尝试合并一个外部类.当我尝试编译时,我得到了这个

1> LINK:致命错误LNK1104:无法打开文件'C:\ Users\brr\documents\visual studio 2012\Projects\sfmlgame\Release\sfmlgame.exe'

我的代码如下:

main.cpp中:

#include "functions.h"
int main()
{
    functions func;
    std::cout << "Testing 123, testing 123!";
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);
    bool running = true;
    while (running)
    {
        func.window.clear();
        func.window.draw(shape);
        func.window.display();
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

functions.h:

#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include<SFML\Network.hpp>
#include <SFML/Window.hpp>
#include <iostream>

class functions
{
public:
    functions(void);
    ~functions(void);
    void Events();
    void Window();
    sf::RenderWindow window;
    sf::Event event;
};
Run Code Online (Sandbox Code Playgroud)

functions.cpp:

#include "functions.h"
functions::functions(void)
{
}

functions::~functions(void)
{
}

void functions::Window(){
    window.setSize(sf::Vector2u(800,600));
    window.setTitle("Test");
}

void functions::Events(){
    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 6

有两种可能性.

1.您无权访问该C:\Users\brr\documents\visual studio 2012\Projects\sfmlgame\Release目录.您可以尝试在此位置创建新文件进行检查.

2.该过程已被使用.运行任务管理器(start->run->taskmgr),并检查是否sfmlgame.exe正在运行.如果是,请终止该过程.