我正在使用Unity开始我的开发.我正在做那样的事情:
if(Input.GetKey(KeyCode.A))newValues[1]-=this.turnSpeed*(float)Time.deltaTime;
if(Input.GetKey(KeyCode.D))newValues[1]+=this.turnSpeed*(float)Time.deltaTime;
transform.Rotate(0, newValues[1], 0);
if(Input.GetKey(KeyCode.W))newValues[0]+=this.speed*transform.forward.z*(float)Time.deltaTime;
if(Input.GetKey(KeyCode.S))newValues[0]-=this.speed*transform.forward.z*(float)Time.deltaTime;
transform.position = new Vector3(transform.position.x, transform.position.y, (float)newValues[0]);
Run Code Online (Sandbox Code Playgroud)
所以我旋转,我可以移动,但它只是在Z线移动,我知道我正在调用Z特定的运动.但使用Javascript我可以做点什么
transform.forward+=this.speed*transform.forward*(float)Time.deltaTime;
Run Code Online (Sandbox Code Playgroud)
因此,我不需要执行新的矢量处理并复制到单独的变量,它就像一个魅力,使用旋转并在旋转时使用自己作为方向.
我需要接受到同一端口的多个连接.我在C++中使用套接字,我想做像SSH这样的事情.我可以做一个ssh user @ machine"ls -lathrR /"并对同一台机器运行另一个命令,即使第一个仍在运行.
我怎样才能做到这一点?
谢谢.
我正在使用QT Creator和旧的GCC,现在我更新到4.8版本.但是GCC 4.8告诉我,QT Creator添加了一个-Xarch_x86_64选项
g++: error: unrecognized command line option '-Xarch_x86_64'
Run Code Online (Sandbox Code Playgroud)
有没有办法删除这个选项?我试着用
CONFIG -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64
QMAKE_CXXFLAGS += -std=c++11 -v
QMAKE_CXXFLAGS += -std=c++0x
QMAKE_CXXFLAGS -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64
QMAKE_CXXFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS += -mmacosx-version-min=10.7
QMAKE_LFLAGS -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64
Run Code Online (Sandbox Code Playgroud)
但到目前为止没有任何反应
注意:我正在使用最后一个QT Creator版本,使用Port下载GCC,我更改了套件上的编译器.
问候
我正在尝试创建一个程序来在屏幕上编写参数.我创建了一些程序来获取C函数参数,或者我使用C将参数发送到我的asm程序.有没有办法只使用汇编程序获取程序参数
EX:
./Program "text"
Run Code Online (Sandbox Code Playgroud)
我正在使用(Gnu Assembler)
通常我会使用这些参数
[esp+4]
Run Code Online (Sandbox Code Playgroud)
因为esp是程序/函数调用指针,但在纯asm中它没有得到命令行参数.
有没有办法做到这一点?
我用Google搜索,但我无法找到更多信息
我收到错误:
proprietario.cpp:36: error: invalid use of incomplete type ‘struct Motocicleta’
proprietario.h:12: error: forward declaration of ‘struct Motocicleta’
Run Code Online (Sandbox Code Playgroud)
Motocicleta.h:
#ifndef __MOTOCICLETA__
#define __MOTOCICLETA__
#include <iostream>
#include "veiculo.h"
#include "proprietario.h"
using namespace std;
class Proprietario;
class Motocicleta:public Veiculo{
public:
Motocicleta(int nPassageiros, string modelo, string placa, int aFabricacao, Proprietario* pai, int nRodas, int aro);
~Motocicleta();
Motocicleta (const Motocicleta& source);
Motocicleta& operator= (const Motocicleta& source);
string toString();
};
#endif
Run Code Online (Sandbox Code Playgroud)
Proprietario.h
#ifndef __PROPRIETARIO__
#define __PROPRIETARIO__
#include <iostream>
#include "motocicleta.h"
#include "caminhao.h"
#include "carreta.h"
#include "carro.h" …Run Code Online (Sandbox Code Playgroud) 我正在将我的项目从mac os x(xcode)转换为windows(visual studio 2013).但是当我尝试使用std :: function时,我遇到了问题.作为一个例子,我宣布.
std::function<void()> processFunc;
Run Code Online (Sandbox Code Playgroud)
但是我得到了几个错误:
Error 1 error C2039: 'function' : is not a member of 'std' ...github\oglengine\engine\game.h 39 1 Engine
Error 2 error C2143: syntax error : missing ';' before '<' ...github\oglengine\engine\game.h 39 1 Engine
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ...github\oglengine\engine\game.h 39 1 Engine
Run Code Online (Sandbox Code Playgroud)
在XCode上我需要启用c ++ 11,但从我在研究中看到的VS 2013启用了C++ 11.
我唯一的C++包括iostream
我应该添加另一个包含?
我有一个程序调用一个tar ..像popen("tar -zcvf")
我想在stdin上写...并获得输出......比如tar -zcvf - /path | tar - zxvf -
所以...一方面我将封装目录中的文件,然后通过stdout发送并写入反向过程..并发送到bash的stdout.
我想做这个管道工艺..
读取一个文件夹/文件并将stdin发送到"提取"内容并读取二进制输出.
我想要这个,因为我可以发送trought套接字数据并在另一边提取而不需要磁盘,我实时压缩和解压缩..
有人可以帮帮我吗?
我看到我需要做一个execl ...但我发现的所有例子都是将孩子的stdout重定向到我的.
我会做那样的事情:
LOOP.
1 Get block of data from stdin
2 Send to child program
3 get the output
4 Do something with the data (send back trough socket)
END_LOOP
OR
LOOP
1 Get block of data from stdin.
2 Send to child program.
END_LOOP
LOOP
1 Get block of data from child program
2 Do something with the data (send back …Run Code Online (Sandbox Code Playgroud) 我创建了一个pathfind算法,我可以设置启发式方法.但我正在使用
function<int (Point2i origin, Point2i destiny)> heuristicFunc;
Run Code Online (Sandbox Code Playgroud)
作为我的函数指针,我想用我的默认heristic初始化它.
所以:
Pathfind.h
class Pathfind{
private:
function<int (Point2i origin, Point2i destiny)> heuristicFunc;
int hMethod(Point2i origin, Point2i destiny);
public:
Pathfind();
}
Run Code Online (Sandbox Code Playgroud)
Pathfind.cpp
Pathfind::Pathfind(){
//1st try
this->heuristicFunc=&Pathfind::hMethod;
//2nd try
this->heuristicFunc=std::bind(&Pathfind::hMethod, this);
}
Run Code Online (Sandbox Code Playgroud)
但它返回相同的错误:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:1472:15:候选功能并不可行:没有已知的转换,从"诠释(核心:: Pathfind ::*)(Point2i,Point2i)'到'const std :: __ 1 :: function,sf :: Point2)>'为第一个参数
为什么它试图从int(Core :: Pathfind ::*)转换?
谢谢.
我创建了一个指针向量
vector<Person*> *personVec = new vector<Person*>();
Run Code Online (Sandbox Code Playgroud)
人包含:
getName();
getAge();
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用迭代器它不起作用..这是我如何使用它:
vector<Person>::iterator it;
for(it = personVec->begin() ;
it != personVec->end() ;
++it)
{
cout << it->getName() << endl;
}
Run Code Online (Sandbox Code Playgroud)
我尝试过,vector<Person*>::iterator it;但也没有运气.
谢谢.
我需要生成一个巨大的文本。
我正在使用 bash,我想将整数转换65为字符,如A. 0所以我在和之间使用随机值255(我需要所有 ASCII 表),转换为 char 并使用>>. 但我无法将bash整数解释为字符。就像printf("%c", 65)在 C++ 中一样。但如果我在 bash 中尝试这个,它会返回 6。