Are tr1 headers available for g++ v3.4.6? If so, how can I locate them at compile time.
The following is failing to compile:
#include <tr1/memory>
With the following error:
myModule.h:20:24: tr1/memory: No such file or directory
Do I need to move to a later compiler or do I have the headers somewhere?
...
I'm currently porting a heap of code that has previously only been compiled with Visual Studio 2008.
In this code, there's an arrangement like this:
template <typename T>
T convert( const char * s )
{
// slow catch-all
std::istringstream is( s );
T ret;
is >> ret;
return ret;
}
template <typename T, typename T2>
T...
I've finished both my C++ 1/2 classes and we did not cover anything on Linking to libraries or adding additional libraries to C++ code.
I've been having a hay-day trying to figure this out; I've been unable to find basic information linking to objects. Initially I thought the problem was the IDE (Netbeans; and Code::Blocks). However I'...
Somebody told me that allocating with malloc is not secure anymore, I'm not a C/C++ guru but I've made some stuff with malloc and C/C++. Does anyone know about what risks I'm into?
Quoting him:
[..] But indeed the weak point of C/C++ it is the security, and the Achilles' heel is indeed malloc and the abuse of pointers. C/C++ it is a...
Possible Duplicate:
Is there a production ready lock-free queue or hash implementation in C++
I'm looking for implementations of lock-free containers:
Queue
Stack
Hash Map
etc...
How about blocking containers:
Blocking Queue
Blocking Stack
Are there any good libraries out there? I would like to refrain from writing the...
I am having trouble writing C++ code that uses a header file designed for a C file. In particular, the header file used a variable name called class:
int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_class, BPY_class_attr_check* class_attrs, PyObject **py_class_attrs);
This works in C as class isn't taken...
I know that you can get a reference to a static method like this:
typedef void (*pointer)();
pointer p = &MyClass::MyMethod;
But is there a way to get a reference to the class itself?
EDIT:
I'd like to store a class name to a variable so i could instantiate different kinds of objects based on the current value of the variable to a b...
Hi all, I have a very strange problem and the following code wont compile:
#ifndef MYWINDOW_HPP_INCLUDED
#define MYWINDOW_HPP_INCLUDED
class MyWindow{
private:
WNDCLASSEX window_class;
HWND window_handle;
HDC device_context_handle;
HGLRC open_gl_render_context;
MSG message;
BOOL quit...
Ok, I'm revising for my upcoming year 2 exams on a CS course and its likely something like this will come up. my question is what is an ideal application that would especially benefit from the program features of each of the three languages? I have a vague idea but getting a second opinion could really help.
JavaPortability, easy - good...
I'm trying to compile SDL_Image 1.2.10 with MinGW + MSys (gcc 4.5.0) on Windows, I have compiled all the requires libs (zlib 1.2.5, libpng 1.4.2, libjpeg 8a, libtiff 3.9.2). SDL_Image compiles fine, but fails to link to libpng, throwing .libs/IMG_png.o:IMG_png.c:(.text+0x16): undefined reference errors on various png structs.
If I run ....
hi, I'm doing simple tests on all files in directory.
But from some reason, sometimes, they behave wrongly?
What's bad with my code?
using namespace std;
int main() {
string s = "/home/";
struct dirent *file;
DIR *dir = opendir(s.c_str());
while ((file = readdir(dir)) != NULL){
struct stat * file_info = new (struct stat...
// ... snipped includes for iostream and fusion ...
namespace fusion = boost::fusion;
class Base
{
protected: int x;
public: Base() : x(0) {}
void chug() {
x++;
cout << "I'm a base.. x is now " << x << endl;
}
};
class Alpha : public Base
{
public:
void chug() {
x += 2;
cout << "Hi, I'm an ...
There are a lot of impressive Boost libraries such as Boost.Lambda or Boost.Phoenix which go a long way towards making C++ into a truly functional language. But is there a straightforward way to create a composite function from any 2 or more arbitrary functions or functors?
If I have: int f(int x) and int g(int x), I want to do someth...
Question:
I want to loop over all open tabs in Internet Exporer (for all open IE windows) and save the URL in a text file. How can I do that ? I have windows 7 32 bit and IE 8.
Code for Firefox/Google chrome would also be welcome.
...
Running gcc v3.4.6 on the Botan v1.8.8 I get the following compile time error building my application after successfully building Botan and running its self test:
../../src/Botan-1.8.8/build/include/botan/secmem.h: In member function `Botan::MemoryVector<T>& Botan::MemoryVector<T>::operator=(const Botan::MemoryRegion<T>&)':
../../src/Bo...
If I wanted to add, let's say, a new .lib to the build only if a particular #define was set, how would I do that?
In the MSVC++ 2008 "Property Pages", you would simply add: Config Properties -> Linker -> Input -> Additional Dependencies, but I would like it if something like #define COMPILE_WITH_DETOURS was set, then the particular libr...
Hello,
A class A possesses an instance c of a class C. Another class B has to modify c through C::setBlah(); method.
Is it bad to create an accessor C getC(); in A and then use A.getC().setBlah() ?
Or should I create a method A::setBlah(); that would call C::setBlah(); ? Isn't it annoying if there are several methods like that ?
...
I do not understand why this code is not valid:
#include <vector>
template <typename T>
class A{
public:
A() { v.clear(); }
std::vector<A<T> *>::const_iterator begin(){
return v.begin();
}
private:
std::vector<A<T> *> v;
};
When compiling it with gcc, it get the following error:
test.cpp:8: error: type 's...
I'm writing a program in C++ that reads in some data from an external file in order to set the values of static variables.
Is it possible to convert a string to an object identifier? (e.g. convert the string "CheckBox::Unchecked" into an identifier for the object CheckBox::unchecked)
...
Using the following pseudo-code:
#define BUILD_PATH "C:/MyBuild/"
#define BUILD_NAME "mydll.dll"
// Set build path here
representing how I would like to build the current project (a dll) into C:/MyBuild/mydll.dll, how would I accomplish this by only using preprocessor directives?
Thanks a bunch!
...