我一直在努力使用boost日志 - 我得到了他们写一个日志文件的简单示例(http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_file.cpp).但是,当我尝试将该代码复制到"Logger"类时,我无法将其写入日志文件.我可以看到文件default.log被创建,但它没有任何内容.
我在debian 7 64bit上.一切都编译好 - 编译行是:
g++ -o build/Logger.o -c -std=c++11 -Wall -g -O0 -DBOOST_LOG_DYN_LINK -DDEBUG src/Logger.cpp
g++ -o build/logtest build/Logger.o -lboost_log -lboost_log_setup -lboost_date_time -lboost_thread -lboost_wave -lboost_regex -lboost_program_options
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
Logger.cpp
/*
* Logger.cpp
*
* Created on: 2011-01-17
* Author: jarrett
*/
#include "Logger.h"
namespace logging = boost::log;
namespace sinks = boost::log::sinks;
namespace src = boost::log::sources;
namespace expr = boost::log::expressions;
namespace attrs = boost::log::attributes;
namespace keywords = boost::log::keywords;
namespace dhlogging {
Logger::Logger(std::string fileName)
{ …Run Code Online (Sandbox Code Playgroud) 我希望在git中有一个分支,它有2个上游分支,这样它就从它们中拉出来并推送到其中一个分支......
这是场景:
MY_BRANCH --> ORIGINAL_BRANCH
MY_BRANCH --> MY_BRANCH
Run Code Online (Sandbox Code Playgroud)
所以,我的新分支,MY_BRANCH从两个ORIGINAL_BRANCH和MY_BRANCH(在origin)拉出,并推到MY_BRANCH(在origin).
这可能在git中吗?
我已经添加了ORIGINAL_BRANCH作为上游,所以当我去git pull它时它从中拉出来.当我这样做时,git push它会推动MY_BRANCH,这很好.
但是我如何让它也跟随它MY_BRANCH,并从中拉出来呢?
(原因是其他开发人员可能会添加一些东西而不是它ORIGINAL_BRANCH).
有任何想法吗?
我正试图让我的头脑围绕助推波,到目前为止,我没有太多运气.
我尝试了网站上的示例代码.它在下面:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
///////////////////////////////////////////////////////////////////////////////
// Include Wave itself
#include <boost/wave.hpp>
///////////////////////////////////////////////////////////////////////////////
// Include the lexer stuff
#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token class
#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer class
int main () {
// The following preprocesses a given input file.
// Open the file and read it into a string variable
std::ifstream instream("lex_infile");
std::string input(
std::istreambuf_iterator<char>(instream.rdbuf()),
std::istreambuf_iterator<char>());
// The template boost::wave::cpplexer::lex_token<> is the
// token type to be used by the Wave library. …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试从我的全屏Xlib OpenGL窗口启用alt-tabbing,但是遇到了一些困难.我试过XUnmapWindow(..),哪种方法有效,但分辨率没有重置(除非我应该手动执行此操作?)并且我的Xlib窗口不会显示为最小化窗口(即我无法将alt-tab返回窗口,即使应用程序似乎仍然在后台运行).
我尝试的下一件事是将窗口从全屏模式更改为窗口模式(即在窗口模式下重新创建窗口),但显然,我宁愿不必这样做.
我正在听FocusOut和FocusIn事件,FocusOut似乎在我的alt-tab时调用,但我不知道如何让我的应用程序正确地最小化.如果在FocusOut调用事件时我的代码中没有做任何事情,我的应用程序不会做任何事情(即我不能最小化窗口).
任何帮助,将不胜感激!
编辑:不幸的是,我无法让X Windows正确地最小化全屏窗口.因此,为了解决这个问题,我决定destroy()使用全屏窗口,然后create()在窗口模式下使用新窗口.似乎运作良好.
我刚开始进行Python Web开发,并选择Bottle作为我的首选框架.
我正在尝试使用模块化的项目结构,因为我可以拥有一个"核心"应用程序,其中包含围绕它构建的模块,这些模块可以在设置期间启用/禁用(或者如果可能的话,即时启动... .不知道我怎么设置那个).
我的"主要"课程如下:
from bottle import Bottle, route, run
from bottle import error
from bottle import jinja2_view as view
from core import core
app = Bottle()
app.mount('/demo', core)
#@app.route('/')
@route('/hello/<name>')
@view('hello_template')
def greet(name='Stranger'):
return dict(name=name)
@error(404)
def error404(error):
return 'Nothing here, sorry'
run(app, host='localhost', port=5000)
Run Code Online (Sandbox Code Playgroud)
我的'子项目'(即模块)是这样的:
from bottle import Bottle, route, run
from bottle import error
from bottle import jinja2_view as view
app = Bottle()
@app.route('/demo')
@view('demographic')
def greet(name='None', yob='None'):
return dict(name=name, yob=yob)
@error(404)
def error404(error):
return 'Nothing …Run Code Online (Sandbox Code Playgroud) 我无法让scons正确编译一个小的线程示例(在Linux上).
如果我运行scons,它会这样做:
jarrett@jarrett-laptop:~/projects/c++_threads$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/main.o -c -std=c++11 -pthread -Wall -g src/main.cpp
g++ -o build/c++threads build/main.o
scons: done building targets.
Run Code Online (Sandbox Code Playgroud)
然后,如果我运行./build/c++threads它会抛出此错误:
terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted
Aborted
Run Code Online (Sandbox Code Playgroud)
如果我从命令行编译:
g++ -std=c++11 -pthread -Wall -g src/main.cpp
Run Code Online (Sandbox Code Playgroud)
它编译成a.out,如果我运行a.out它运行程序(为线程做一些输出等).
这是我的SConstruct文件:
# Tell SCons to create our build files in the 'build' directory
VariantDir('build', 'src', duplicate=0)
# …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用Quaternions,但是我在使用Quaternions使一个简单的FPS相机正常工作时遇到了一些烦人的困难.
基本上,每当我尝试移动鼠标时,我在屏幕上绘制的三角形变得疯狂,并且在屏幕上移动的速度比我看到的要快.移动键(wsad)按预期工作,UNTIL我移动鼠标,然后它全部搞砸了.我认为问题在于轮换,但过去几天我一直在倾向于这个问题但无济于事.
这是一个正在发生的事情的视频:四元数测试视频
仅供参考,以下是我正在使用的3个主要类:
Quaternion.h
CameraSceneNode.h
CameraSceneNode.cpp
最相关的部分是tick()(我更新旋转四元数)和render()(我渲染'相机',其中包括旋转和平移场景).
这是tick()方法:
void CameraSceneNode::tick(float32 time) {
// movement direction
if (movement_[MOVE_DIR_FORWARD] == 1)
pos_ += rotation_ * vmath::Vector3f(0, 0, -moveSpeed_ * time);
if (movement_[MOVE_DIR_BACKWARD] == 1)
pos_ += rotation_ * vmath::Vector3f(0, 0, moveSpeed_ * time);
if (movement_[MOVE_DIR_LEFT] == 1)
pos_ += rotation_ * vmath::Vector3f(-moveSpeed_ * time, 0, 0);
if (movement_[MOVE_DIR_RIGHT] == 1)
pos_ += rotation_ * vmath::Vector3f(moveSpeed_ * time, 0, 0);
// …Run Code Online (Sandbox Code Playgroud) 是否可以在gerrit提交消息中具有"自定义"更改ID?
例如,
- My commit message
Change-Id: BM10945
Run Code Online (Sandbox Code Playgroud)
BM10945更改的蓝色票在哪里.
我一直(missing or invalid Change-Id line format in commit message footer)从格里特得到一个,不能承诺.
好的,所以我能够加载一个带有顶点,纹理坐标和法线的基本模型,并且可以毫无问题地渲染它.
但是,当我尝试投入一些骨骼信息时,当我尝试在着色器中操作骨骼数据时,骨骼数据似乎正在被破坏(或其他什么?).
这是我加载和渲染数据到opengl的代码(设置着色器并发送视图矩阵,世界矩阵等在另一个类中完成):
/*
* Mesh.cpp
*
* Created on: 2011-05-08
* Author: jarrett
*/
#include <boost/log/trivial.hpp>
#include "../common/utilities/AssImpUtilities.h"
#include "Mesh.h"
namespace glr {
namespace glw {
Mesh::Mesh(IOpenGlDevice* openGlDevice,
const std::string path,
std::vector< glm::vec3 > vertices,
std::vector< glm::vec3 > normals,
std::vector< glm::vec2 > textureCoordinates,
std::vector< glm::vec4 > colors,
std::vector<VertexBoneData > bones,
BoneData boneData)
: openGlDevice_(openGlDevice), vertices_(vertices), normals_(normals), textureCoordinates_(textureCoordinates), colors_(colors), bones_(bones), boneData_(boneData)
{
BOOST_LOG_TRIVIAL(debug) << "loading mesh into video memory...";
// create our vao
glGenVertexArrays(1, &vaoId_);
glBindVertexArray(vaoId_);
// create our vbos …Run Code Online (Sandbox Code Playgroud) 我有一个使用 SCons 和 MS VS 2013 (express) 编译器(从命令行编译)构建的项目。
它可以编译并运行,但是,它会定期崩溃,所以我想调试它。
我添加了以下标志:
/Zi # Debug symbols
/DEBUG # Debug symbols
/FS # Concurrent debug database file access
Run Code Online (Sandbox Code Playgroud)
构建后,我看到pdb生成了一个名为vc120.pdb. 我的可执行文件位于一个build文件夹中,该pdb文件位于主项目目录中。
但是,当我尝试附加可执行文件以通过 VS2013 或 WinDbg 进行调试时,我总是收到错误消息,指出无法找到调试符号。
我在 VS2013 和 WinDbg 中都添加了文件的“路径” pdb,但得到了相同的结果。我还尝试将pdb文件复制到目录中build(使其位于我的可执行文件旁边),但没有骰子。我什至更改了文件的名称pdb以匹配我的可执行文件的名称,但这也不起作用。
我在这里缺少什么吗?
我正在尝试编译我的'图形'引擎,但在包含<string>(Debian Testing 64bit)之后遇到了问题.
这是错误:
jarrett@jarrett-g74s:~/projects/icebreak/ice_engine$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/engine/gui/GUI.o -c -I"../lwis/src/engine" src/engine/gui/GUI.cpp
In file included from /usr/include/c++/4.7/bits/postypes.h:42:0,
from /usr/include/c++/4.7/bits/char_traits.h:42,
from /usr/include/c++/4.7/string:42,
from src/engine/gui/GUI.h:11,
from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/cwchar:66:11: error: ‘::mbstate_t’ has not been declared
/usr/include/c++/4.7/cwchar:141:11: error: ‘::wint_t’ has not been declared
/usr/include/c++/4.7/cwchar:143:11: error: ‘::btowc’ has not been declared
/usr/include/c++/4.7/cwchar:144:11: error: ‘::fgetwc’ has not been declared
/usr/include/c++/4.7/cwchar:145:11: error: ‘::fgetws’ has not been declared
/usr/include/c++/4.7/cwchar:146:11: error: ‘::fputwc’ has …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了rvm,我正在尝试使用以下命令安装ruby版本:
rvm install ruby-1.9.1
Run Code Online (Sandbox Code Playgroud)
我得到了一堆似乎源于此的错误:
Fetching yaml-0.1.4.tar.gz to /usr/share/ruby-rvm/archives
....
Warning: Failed to create the file yaml-0.1.4.tar.gz: Permission denied
Run Code Online (Sandbox Code Playgroud)
所以,我查看目录/ usr/share/ruby-rvm/archives的权限.它看起来像这样:
drwxrwsr-x 24 root rvm 4096 2012-02-26 13:29 archives
Run Code Online (Sandbox Code Playgroud)
好的.所以我把自己添加到组rvm:
sudo usermod -G rvm jarrett
Run Code Online (Sandbox Code Playgroud)
然后再试一次.没有骰子 - 我得到了同样的错误.然后我试试这个:
sudo usermod -a -G rvm jarrett
Run Code Online (Sandbox Code Playgroud)
仍然无法正常工作.那么,我然后将/ usr/share/ruby-rvm的组更改为jarrett:
sudo chgrp -R jarrett /usr/share/ruby-rvm
Run Code Online (Sandbox Code Playgroud)
现在它工作正常.
所以,我的问题是:为什么世界上不是rvm小组工作?
我正在尝试将我的固定功能管道 openGL 代码移植到使用 GLSL,但是我遇到了glBufferData. 这一切都与固定功能的东西配合得很好(即我可以毫无问题地渲染加载的网格)。
以下是加载顶点的代码(来自 AssImp 导入器库):
Mesh.h文件中定义:
...
glm::detail::uint32 vaoId_[];
glm::detail::uint32 vboIds_[];
std::vector< glm::vec3 > vertices_;
std::vector< glm::vec3 > normals_;
std::vector< glm::vec2 > textureCoordinates_;
std::vector< glm::vec4 > colors_;
...
Run Code Online (Sandbox Code Playgroud)
在Mesh.cpp中实现:
...
Mesh::Mesh(const aiMesh* mesh) {
vaoId_[1];
vboIds_[4];
BOOST_LOG_TRIVIAL(debug) << "loading mesh...";
glm::detail::uint32 currentIndex = 0;
for (glm::detail::uint32 t = 0; t < mesh->mNumFaces; ++t) {
const aiFace* face = &mesh->mFaces[t];
GLenum face_mode;
switch(face->mNumIndices) {
case 1: face_mode = GL_POINTS; break;
case 2: face_mode = GL_LINES; break; …Run Code Online (Sandbox Code Playgroud) c++ ×8
opengl ×3
boost ×2
git ×2
3d ×1
boost-log ×1
bottle ×1
branch ×1
camera ×1
debugging ×1
frameworks ×1
fullscreen ×1
g++ ×1
gcc4.7 ×1
gerrit ×1
git-pull ×1
git-push ×1
glsl ×1
linux ×1
minimize ×1
module ×1
permissions ×1
pthreads ×1
python ×1
quaternions ×1
rotation ×1
ruby ×1
rvm ×1
scons ×1
std ×1
xlib ×1