i have written the body of the function in the header file and so do not have a source file. when i tried running my project in visual studio .. i got an
error: Cannot open source file: No such file or directory.
How do I make visual studio understand that the definitions of the function are within the header itself?
...
I know there are a number of questions about senior project ideas but I am specifically looking for a project that involves Unix system programming in C or (preferably) C++. I have the book which I used for one quarter but haven't had a chance to use since. I want to find a project that will give me as much experience with Unix system ...
Is there any portable way to determine what the maximum possible alignment for any type is?
For example on x86, SSE instructions require 16-byte alignment, but as far as I'm aware, no instructions require more than that, so any type can be safely stored into a 16-byte aligned buffer.
I need to create a buffer (such as a char array) wh...
I come across this term "dependent names" typically in the context of templates. However, I rarely touch the latter. Thus naturally would like to know more about the concept of dependent names.
How do you understand it in the context of templates and outside of them? example are critically encouraged!
...
Why do I get an extra iteration (extra line printed) when this code completes? Does there need to be an extra newline at the EOF? I would prefer not having to add extra/special characters to mark the EOF.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
ifstream infile("dictionar...
Most resources available online are very outdated. Specifically, they are all about OpenGL 2 which matches to DirectX 9.
The current specification is 3.2 which is equivalent (or, well, very close) to DirectX 10 (11). But the specification itself is very hard to read. In contrast, DirectX SDK is a wonderful piece of documentation, sample...
This feels a lot like finding a needle in a hay stack but here goes.
I'm building a Windows Mobile 6.1 application. Specifically I'm trying to port over the OpenCV framework. Having successfully (doubtfully) compiled OpenCV for the ARM4I architecture, I'm trying it out in a simple hello world style application.
From my WinCE .EXE I'm c...
How can I get the same handeling of casting for user-defined types as built in, eg:
float a = 5.4;
std::string s = a;//error, no conversion avaible
int x = a;//warning, possible data loss
int y = (int)a;//fine
int z = static_cast<int>a;//fine
float b = c;//warning, possible data loss
Now say I have my own Int and Float class, how do I...
I know this question has been asked before but I still haven't seen a satisfactory answer, or a definitive "no, this cannot be done", so I'll ask again!
All I want to do is get the path to the currently running executable, either as an absolute path or relative to where the executable is invoked from, in a platform-independent fashion. ...
I'm running into an issue with floating point exceptions turned on in Visual Studio 2005. If I have code like this:
double d = 0.0;
double d2 = 3.0;
double d3 = d2/d;
and if I register an SEH handler routine, then I can easily turn the div-by-zero into a C++ exception and catch it. So far so good.
However, when I do this, the f...
I have the following function that will convert a string into a numeric data type:
template <typename T>
bool ConvertString(const std::string& theString, T& theResult)
{
std::istringstream iss(theString);
return !(iss >> theResult).fail();
}
This does not work for enumerated types, however, so I have done something like this:
...
The compiler says it can't find the reference for the function when I do this:
// link.h
template <class T>
T *Link(T *&, T *(*)())
// link.cpp
template <class T>
T c:Link(T *&ChildNodeReference, T *(*ObjectCreator)()){
}
If I implement inside the class on the header it goes smoothly.
Please, I will work on the header until som...
Hi, I was wondering if anyone can help me with functors. I dont really understand what functors are and how they work I have tried googling it but i still dont get it. how do functors work and how do they work with templates
...
string str = "";
for ( int x = 0; x < str.length(); x++ );
...
Question:
Are there Windows API calls (perhaps NTFS only) which allows one to split a very large file into many others without actually copying any data (in other words, specify the logical breakpoints between joined files, with file names and sizes)?
Examples: SetFileValidData, NtSetInformationFile
Scenario:
I need to programatically...
I want to change the background color of a QPlainTextEdit, how do I do this?
...
My problem: I've found that processing large data sets with raw C++ using the STL map and vector can often be considerably faster (and with lower memory footprint) than using Cython.
I figure that part of this speed penalty is due to using Python lists and dicts, and that there might be some tricks to use less encumbered data structur...
I need to decrypt some data files with wincrypt and examples are few and far between online. The most solid example I've found is here. However, this is using all sorts of types I cannot seem to find information about (CBase64Utils, CString, etc).
I am reading the final solution, trying to understand the process, and have come to this...
Im just getting garbage values. And it is wierd the debugger shows the correct values. But its printing weird stuff insted...
this frist part is fine. Essentially, It just takes me to my problem. I have what I need to print inside that h.hashtable[hashIndex] array.
ostream& operator<<(ostream& out, const hashmap& h)
{
const cha...
Why would you use if-else statements if you can make another if statement?
Example with multiple ifs:
input = getInputFromUser()
if input is "Hello"
greet()
if input is "Bye"
sayGoodbye()
if input is "Hey"
sayHi()
Example with else-if:
input = getInputFromUser()
if input is "Hello"
greet()
else if input is "Bye"
...