我最近一直在尝试重新构建我的项目,以便我可以在我的桌面上更新我的可执行文件,但由于某种原因,它无法构建显示此错误的项目:
Updating property file: F:\JDA\CalculatorMedii\build\built-clean.properties
Deleting directory F:\JDA\CalculatorMedii\build
F:\JDA\CalculatorMedii\nbproject\build-impl.xml:1019: Unable to delete file F:\JDA\CalculatorMedii\dist\CalculatorMedii.jar
BUILD FAILED (total time: 0 seconds)
Run Code Online (Sandbox Code Playgroud)
我尝试手动删除该文件,但这又出现了另一个错误。我恢复了它。知道如何解决这个问题吗?我还应该提到我的项目 100% 干净,代码中没有错误,我可以随时通过 NetBeans 运行它。唯一的问题是当我尝试重建或构建和清理时,它会显示该错误。
我也在使用 NetBeans 7.0.1
问题已解决。重新启动 netbeans 然后构建解决了这个问题。
我用C++编写了一个小程序,提示用户输入,用户给出一个数字,然后计算机显示反转的数字.
例如:17变为71. 123变为321.
这是该计划:
#include <iostream>
#include <string> //for later use.
using namespace std;
int rev(int x)
{
int r = 0;
while(x)
{
r = (r*10) + (x%10);
x = x/10;
}
return r;
}
int main()
{
int nr;
cout << "Give a number: ";
cin >> nr;
rev(nr);
cout << nr;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
程序的最终结果:打印相同的数字,功能无效.我究竟做错了什么?我尝试了几种解决方案但无济于事.
我正在使用Allegro 5中的第一个游戏,我已经有了标题菜单渲染,但是我想在菜单中添加可点击的文本.如何将其设置为当您将鼠标悬停在文本上时可以单击它?我正在考虑使用for语句检查像素对性能非常不利,这是我到目前为止所做的:
#include <allegro5\allegro.h>
#include <allegro5\allegro_image.h>
#include <allegro5\allegro_primitives.h>
const int width = 1280;
const int height = 720;
int main(void)
{
al_init();
al_init_primitives_addon();
al_init_image_addon();
ALLEGRO_DISPLAY *display = al_create_display(width, height);
ALLEGRO_BITMAP *title = al_load_bitmap("titlemenu.bmp");
al_clear_to_color(al_map_rgb(0, 0, 0));
al_draw_bitmap(title, 0, 0, 0);
al_flip_display();
al_rest(3.0);
al_destroy_display(display);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Windows XP SP3上的代码块
我基本上试图在visual studio 2008中编写一个基本的转换器,我有两个文本框,一个用户输入,另一个用输出结果.当我按下按钮时,我希望第一个文本框中的输入乘以4.35然后显示在第二个文本框中.到目前为止,这是我在按钮代码中的代码:
String^ i1 = textBox1->Text;
float rez = (i1*4.35)ToString;
textBox2->Text = rez;
Run Code Online (Sandbox Code Playgroud)
但是我收到这些错误:
f:\microsoft visual studio 9.0\projects\hellowin\hellowin\Form1.h(148) : error C2676: binary '*' : 'System::String ^' does not define this operator or a conversion to a type acceptable to the predefined operator
f:\microsoft visual studio 9.0\projects\hellowin\hellowin\Form1.h(148) : error C2227: left of '->ToString' must point to class/struct/union/generic type
f:\microsoft visual studio 9.0\projects\hellowin\hellowin\Form1.h(149) : error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'float' to 'System::String ^'
Run Code Online (Sandbox Code Playgroud)
请帮助我疯狂地从C++中的文本框中获取一些输入是多么的荒谬.我用谷歌搜索了我的每一个错误,没有任何有用的信息,我已经找了一个小时的答案,请帮忙.
我写了一个基于多维数组的基本tic-tac-toe游戏.克[3] [3].在我的程序中,我有大约9个条件,比如我要向您展示的条件:
if((g[0][0] == X && g[0][1] == X && g[0][2] == X) || (g[0][0] == O && g[0][1] == O && g[0][2] == O))
Run Code Online (Sandbox Code Playgroud)
这太疯狂了.我可能做错了,但这就是为什么我要解决这个问题.是否有更简单的方法来表示像这样的长而复杂的条件?例如我不能以某种方式做:
if(grid.hasXes)
Run Code Online (Sandbox Code Playgroud) 我试图用Cmake实际构建PhysFS库,我使用的是Code :: Blocks mingw makefile.我可以在我的项目中导入,我可以在技术上声明PhysFS_init()函数(虽然这给我的参数错误太少)但是当我添加一个参数时它告诉我PHYSFS_init是一个未定义的引用.
这对我来说听起来很愚蠢,当你没有争论的时候你怎么能认出它,但是当我添加一个参数时假装它不存在?我已经运行了两次CMake,但我只是得到了这个:
[...]\src\main.cpp|20|undefined reference to `PHYSFS_init'|
Run Code Online (Sandbox Code Playgroud)
代码,如果有必要(只是一点,其余的是无关紧要的):
#include <SFML/Window.hpp>
#include <SFML/System.hpp>
#include <iostream>
#include "Globals.h"
#include "GameStates.h"
#include "GameWindow.h"
#include "GameMenu.h"
#include <physfs.h>
int main(int argc, char** argv)
{
///<|===================| Classes & Declarations |===================|>
sf::Event ev;
sf::RenderWindow winMain ( sf::VideoMode( WindowWidth, WindowHeight, 32 ), WindowTitle );
sf::Image Icon;
GameStates gameState;
GameMenu TitleMenu;
MenuButton buttons[4];
PHYSFS_init(NULL);
Run Code Online (Sandbox Code Playgroud)
为什么会这样?为了能够在我的项目中使用PhysFS,我该怎么办?我用CMake构建了库,我包含了我需要的库,并且我尝试初始化PhysFS,这给了我一个错误,让我觉得C++编译程序的方式很愚蠢.
我无法购买Visual studio.我只是想知道除Visual Studio之外是否有任何其他程序可用于开发C++桌面应用程序.
当C++程序失败时返回的价值是多少?我已经阅读了一些关于此的文章,但没有明确说明.
如果它没有返回0,有没有办法让程序在失败时返回0或NULL?关于std :: nothrow我有点红,但到目前为止还没有找到实际的例子.任何人都可以向我澄清这个吗?
我只是开始学习Java(我是学生,而C++是我最熟悉的基础语言),而且我遇到了访问和修饰符.
在代码中我看到了使用
public int NAME;
// and
int NAME;
Run Code Online (Sandbox Code Playgroud)
这有什么不同吗?如果是这样,有什么区别.它究竟做了什么?
在阅读了C++网站上的课程教程后,我学到了以下一段代码,然后我尝试使用它:
class CVector {
public:
int x,y;
CVector () {};
CVector (int,int);
CVector operator + (CVector);
};
CVector::CVector (int a, int b) {
x = a;
y = b;
}
Run Code Online (Sandbox Code Playgroud)
之后我编写了以下代码,以便学习如何有效地编写C++类并编写更清晰的代码:
class Player {
public:
string name;
int level;
};
Player::Player(int y) {
level = y;
}
Run Code Online (Sandbox Code Playgroud)
但是它给了我错误C2511:'Player :: Player(int)':在'Player'中找不到重载的成员函数.我搜索了错误,但我没有找到解决方法.这段代码出了什么问题?