Category "c++"

GTK Image from String

I am trying to display an image based on a string of hex pixel data. The string object being transmitted to me is similar to the following: std::string image_b

C++ Include Guards for Standard Headers

I am wondering if/ what include guards on files like windows.h, math.h, iostream, stdio... etc. Since I have those headers included multiple times in different

Does auto deduce the type at compile time or runtime in C++ 11?

Consider the following auto a = 10; When does the compiler know that a is an int, at compile time or at run-time? If it deduces the type at run-time, will it n

error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj

I was converting my projects from VS2010 to VS2012.But I am getting an _MSC_VER linker error in certain projects. After a long surfing through google I found ou

qemu-system-i386: Error loading uncompressed kernel without PVH ELF Note

Im trying to boot my OS to qemu with this code: qemu-system-i386 -kernel MyOS/mykernel.elf But I keep getting this error: qemu-system-i386: Error loading uncom

How to extract prime numbers from a fibonacci series in C++?

Please help my code is as follows. I have found out the Fibonacci series within a range successfully but I am finding it difficult to extract the prime numbers

How undefined are __builtin_ctz(0) or __builtin_clz(0)?

Background For a long time, gcc has been providing a number of builtin bit-twiddling functions, in particular the number of trailing and leading 0-bits (also f

How do I remove EOF in cin buffer?

I'm using an example to show what I mean: On my Mac, to leave the first "while loop", the user has to type "CTRL+D". From what I understand, that is achieved by

Check if a given ostream object has been written to

Can I query an ostream object about whether or not it has been written to? For an ostringstream, one could use if(!myOssObject.str().empty()) What about the

Why if I use a QImage instead of imread I get a null pixmap.?

I try to execute the next code, But If I use a file Image the code run well but If I tried to use a QImage I get the next error. In the same way I get the error

Windows CreateFile Possible Error Codes

I'm playing around with abstracting Windows, Linux, and Mac File IO calls into macros (to avoid C runtime, so no fopen, fclose, etc...). I've actually got quit

Difference between using .ipp extension and .cpp extension files

Suppose I have 2 header files, 1 .ipp extension file and a main.cpp file: First header file myClass1.h (like interface in Java): template<class T> class m

How do I use SDL2 in my programs correctly?

I want to make a game using SDL2, but I'm unable to compile and/or run my code, please help! SDL2 is notoriously hard to set up, and it's often the first libr

Why I need times in closing files in flow

I'm new to c++ and I have question. I have code like: void FlowState::closeFile() { if (outfile) { //from here struct timeval times[2];

No operator ">>" matches these operands operand types are: std::istream >> double

For my project I'm trying to create a free function for a complex number class. It is defined in the cpp file. The function is an overloaded input streaming ope

how to get the slope of a linear regression line using c++?

I need to attain the slope of a linear regression similar to the way the Excel function in the below link is implemented: http://office.microsoft.com/en-gb/ex

BSTR's and VARIANT's under... mac os x

Under mac os x I have office 2011 and its excel and VBA, and I have gcc-5.3.0's g++. I played a lot to passing arrays (of numerical built-in types) from VBA to

Has the C++ standard committee considered templated namespaces?

Namespaces are in many was like classes with no constructors, no destructors, no inheritance, final, and only static methods and members. After all, this kind o

Can't use enum class as unordered_map key

I have a class containing an enum class. class Shader { public: enum class Type { Vertex = GL_VERTEX_SHADER, Geometry = GL_GEOMETRY_SHADE

Change default working directory in Qt Creator

Is it possible to change the default Working directory in Qt Creator to specified path? Or is it possible to set Working directory in .pro file? PS: I know ab