是否有任何方式/ SW-tool可用于监视目录以更改文件,然后将其备份到唯一文件或版本控制系统?
原因:我正在使用Code :: Blocks并进行编辑/测试/更改,偶尔(@#$%!)会希望/需要还原/恢复前一段代码.我希望备份在后台静默发生,这是一个安装和忘记的事情,直到我需要它.理想情况下,每次保存文件时都必须备份文件.
[编辑2010-09-29]
我已经使用了Matthew Iselin的第二个建议(incron)来创建我自己的解决方案,' simplebup ',我在GitHub上开源了.希望它对其他人有用.
我上课了.我制作了两个单独的文件,标题和c ++文件.我正在使用它为我正在进行的opengl游戏创建一个或多或少的Light'对象'.这是文件:Light.h
#ifndef LIGHT_H
#define LIGHT_H
class Light
{
public:
Light(float ix, float iy, float iz, float ir, float ig, float ib , float ia, int itype, int iindex);
virtual ~Light();
float x,y,z;
int index;
int type;
struct ambient
{
float r, g, b, a;
};
struct diffuse
{
float r, g, b, a;
};
struct specular
{
float r, g, b, a;
};
protected:
private:
};
#endif // LIGHT_H
Run Code Online (Sandbox Code Playgroud)
而且,Light.cpp
#include "../include/Light.h"
Light::Light(float ix, float iy, float iz, float …Run Code Online (Sandbox Code Playgroud) 我是一个初学者,我开始掌握一些事情,但我正在为这个人添加另一部分计算器.
我有这个main.cpp,我添加了一点selection == 5:
#include <iostream>
#include <string.h>
using namespace std;
// Function includes
// I try to keep them in the order they appear in the
// output below for organization purposes
#include "calc.m.xy12plugin.cpp"
#include "calc.b.xymplugin.cpp"
#include "calc.m.xybplugin.cpp"
#include "calc.point.xymplugin.cpp"
#include "calc.parallelplugin.cpp"
// The above one would be here, too
int main(int argc, const char* argv[]) {
int i;
i = 0;
cout << "Linear Equation Calculator" << endl << "Copyright (c) 2011 Patrick Devaney" …Run Code Online (Sandbox Code Playgroud) 我有以下代码,我目前用来调用C#Dll中的函数,它在Visual C++中完美运行.
#include <mscoree.h>
#include <stdio.h>
#pragma comment(lib, "mscoree.lib")
void Bootstrap()
{
ICLRRuntimeHost *pHost = NULL;
HRESULT hr = CorBindToRuntimeEx(L"v4.0.30319", L"wks", 0, CLSID_CLRRuntimeHost, IID_ICLRRuntimeHost, (PVOID*)&pHost);
pHost->Start();
printf("HRESULT:%x\n", hr);
// target method MUST be static int method(string arg)
DWORD dwRet = 0;
hr = pHost->ExecuteInDefaultAppDomain(L"c:\\temp\\test.dll", L"Test.Hello", L"SayHello", L"Person!", &dwRet);
printf("HRESULT:%x\n", hr);
hr = pHost->Stop();
printf("HRESULT:%x\n", hr);
pHost->Release();
}
int main()
{
Bootstrap();
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我将其移动到Code :: Blocks(我更熟悉 - 因为我所做的小C++本机)会引发很多编译器错误.
原始编译器错误是因为它无法找到标头mscoree.h.我在.NET SDK中找到了这个,所以我把它复制到mingw include目录中解决了这个问题,然后我对它找不到的所有其他头文做了同样的事情.
复制完所有标题后,它开始给出一大堆其他错误,与我刚刚移动的标题中的代码有关 - 与下面的代码无关.
当VS直接从蝙蝠上运行时,为什么Code :: Blocks难以运行这个?
谢谢
有一个问题,因为我试图链接到头文件,编译器找不到它.我通常使用VS进行C++开发,所以我很困惑为什么这种方法不能以类似的方式工作,除非我做错了.
项目图像,包括常量文件所在的位置. http://puu.sh/4oK3K.png
调试窗口的图片 http://puu.sh/4oKJN.png
错误文字:
C:\ Users\Chris\Desktop\ECS-master\include\Components\Component.hpp | 9 |致命错误:include\Constants.hpp:没有这样的文件或目录 || ===构建完成:1个错误,0个警告(0分0秒)=== |
我刚开始从代号为:: blocks的superbible(第6版)学习openGL.但是当我尝试运行第一个示例代码时,我从sb6.h文件中获得了一个未定义的平台错误.
示例代码:
#include "sb6.h"
// Derive my_application from sb6::application
class my_application : public sb6::application
{
public:
// Our rendering function
void render(double currentTime)
{
// Simply clear the window with red
static const GLfloat red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glClearBufferfv(GL_COLOR, 0, red);
}
};
// Our one and only instance of DECLARE_MAIN
DECLARE_MAIN(my_application);
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这一问题?
我无法使用Code Blocks IDE来编译它在创建新C项目时创建的hello world C程序.我安装了MinGW,它被IDE认可.但是当我尝试构建时,我得到以下输出:
-------------- Build: Debug in TestC3 (compiler: GNU GCC Compiler)---------------
mingw32-gcc.exe -Wall -g -c
C:\Users\jody\codeblocks\testc3\TestC3\main.c -o obj\Debug\main.o
mingw32-g++.exe -o bin\Debug\TestC3.exe obj\Debug\main.o Execution
of 'mingw32-g++.exe -o bin\Debug\TestC3.exe obj\Debug\main.o' in
'C:\Users\jody\codeblocks\testc3\TestC3' failed.
Run Code Online (Sandbox Code Playgroud)
为什么它试图跑得mingw32-g++.exe那么好mingw32-gcc.exe?(如果它不应该这样做,我怎么能配置它不?)
在上一个问题之后,我放弃了安装并销毁了安装,重新开始安装。重新安装MinGW,代码块(带有MinGW)和SDL。按照本教程(http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php)进行操作。而且,每次我尝试编译时,无论项目是不是新项目,都将遭受主题标题中的错误消息。
我已经尝试了此解决方案(在Code :: Blocks中编译SDL时出现“ winapifamily.h:没有这样的文件或目录”),但它仍然普遍存在。我已经炸毁了安装程序以重新开始。我现在没有其他选择了。谁能告诉我为什么这种情况还在发生?
我正在使用最新版本的MinGW,SDL和代码块。
给定一个数组myarr和数组foo的每个元素都能理解的方法,我可以通过以下方式生成一个新数组:
mapper = :foo
newarr = myarr.map(&mapper)
Run Code Online (Sandbox Code Playgroud)
因为&快捷方式将存储的符号mapper转换为Proc.
假设mapper不是Symbol,但已经是一个Proc实例.这个,然后:
mapper = :foo.to_proc
newarr = myarr.map(mapper)
Run Code Online (Sandbox Code Playgroud)
引发错误,因为Array#map不接受参数.
我当然可以这样做:
newarr = myarr.map {|x| mapper.call(x)}
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有一个&:foo我可以在这里使用的快捷方法(类似).
在Windows 10(丹麦语)的Codeblocks中使用K&R中的代码示例.以下示例按预期工作:
#include <stdio.h>
int main() {
char c = 'a';
putchar(c);
}
Run Code Online (Sandbox Code Playgroud)
但是,下面打印一系列带有问号的方框,与我输入的字符数相同:
#include <stdio.h>
int main() {
char c;
while (c = getchar() != '\n') {
putchar(c);
}
}
Run Code Online (Sandbox Code Playgroud)
所以它看起来像编码问题.运行时,会在标题中打开一个命令提示符,其中包含"C:\ Users\username\Desktop\filename.exe",我的用户名包含丹麦字符"å",后面用"Õ"替换.命令提示符使用CP 850字符集.
(顺便说一句,我没有检查字符是否等于EOF,因为这会产生奇怪的结果.按Enter键打印预期的盒子数,再加上一个\n,但它不会结束程序.)