Why this can't compile:
// RefToPointers.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using std::cout;
class T
{
public:
T(int* value):data_(value)
{
}
int* data_;
int* getData_()
{
return data_;
}
int getValue()//<----------Here I do n...
Bear with me because I'm self taught in C++ and am spending my limited extra time on the job to try to learn more about it (I'm a chemical engineering researcher by day).
I have a pretty simple objective:
1. Make a size-safe container to store a long list of floats.
2. Make a specialized version of that container that acts as a matri...
I have successfully constructed something similar to the following code in visual studio 2008:
class OpDevconfigSession;
class DevconfigSession
{
...
private
friend class OpDevconfigSession;
};
Again, this works quite well with visual studio. However, if I try to compile the code under g++ version 4.3.2, I get an error message su...
How to select a value from a table and store in a variable in my sql++
e.g select name from employee;
write this query in c++ and then store the name in variable e_name
...
Hi,
What's the thoughts on allowing simple constructor/method definitions in header files in C++. Some classes I am creating are simple data objects that compose another object say, so they need there own constructor and get/set methods. However these are usually < 3-4 lines each with the constructors using init lists. Is it OK to just...
I've read the tutorial at, and I generally get how that works:
http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#simple
I am trying to build this mysql++ code, and I'm getting an error:
std::ostringstream query3;
query3<<"select pipe_id from pipe where version_id='"<<id<<"'";
std::storeQueryResult ares=query3.store();
for(...
I want to understand how huge graphs can be implemented, so that graph algorithms run faster with huge graphs.
...
Hi.
I have written a program with c++ and compiled it with gcc ( like the sample in the fastcgi.com) but i dont know how to run it on localhost.
everywhere i searched , i found the php configuration for mod_fcgi which wont work
for c++.
does any body configured apache and mod_fcgi to run a c++ web application ???
...
Here is my code
int main(int argc,char *argv[])
{
mysql_init(&mysql);
connection = mysql_real_connect(&mysql,.............,"3306",0);
if (connection == NULL)
{
cout << mysql_error(&mysql);
return 1;
}
else
{
int id=1;
mysqlpp::Query query=connection.query("select * from pipe");
//query3<<"select pipe_id from pipe w...
I'm trying to following the examples on this page:
http://www.boost.org/doc/libs/1_40_0/libs/exception/doc/motivation.html
The minute I try the following line:
throw file_read_error() << errno_code(errno);
I get an error:
error C2440: '<function-style-cast>' : cannot convert from 'int' to 'errno_code'
How do I get this to work??
...
I want to know the size of the next UDP datagram in the system's queue.
I found this question with a similar doubt, but using boost. The last answer (as of 2010/09/23) say something about using getsockopt with the SO_NREAD option in OS X, but I can't find anything about this with Windows (using Winsock).
Here I found that I can use ioc...
From jmorecfg.h:
#define PACK_TWO_PIXELS(l,r) ((r<<16) | l)
#define PACK_NEED_ALIGNMENT(ptr) (((int)(ptr))&3)
#define WRITE_TWO_PIXELS(addr, pixels) do { \
((INT16*)(addr))[0] = (pixels); \
((INT16*)(addr))[1] = (pixels)>>16; \
} while(0)
#define WRITE_TWO_ALIGNED_PIXELS(addr, pixels) ((*(INT32*)(a...
Possible Duplicate:
Variable length arrays in C++?
I am just curious, is there any particular reason why C++ does not allow variable length arrays?
...
I can't find a simple CToolBar example of all things..
I created a toolbar in the resource editor, and loaded the toolbar in my code like this:
toolbar = new CToolBar;
toolbar->CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP, CRect(0, 0, 0, 0), AFX_IDW_TOOLBAR);
toolbar->LoadToolBar(IDR_TOOLBAR);
I have also handl...
I need to initialize some comparator of the new data type TType based on std::set with some object o of another class Object:
typedef std::set <unsigned int, sortSet(o)> TType
This declaration is otside the class (in header file). At the time of the declaration this object does not have to exist, it will be created later.
class sortS...
Hey guys, I was writing some code and I found a peculiar error. The function convert_vector2d(&i_scale) converts a string to a vector2d (inherits from sf::vector2f). If you examine the next few lines of code, I am doing the same operation twice.
Code: Select all
float x = convert_Vector2D(&i_scale).x;
float y = convert_Vector2D(&i_scal...
Given:
typedef type-declaration synonym;
I can see how:
typedef long unsigned int size_t;
declares size_t as a synonym for long unsigned int, however I (know it does but) can't see exactly how:
typedef int (*F)(size_t, size_t);
declares F as a synonym for pointer to function (size_t, size_t) returning int
typedef's two operands...
I have a std::vector (let's call it "data_vector") that I want to synchronize parts of across processors. I.e., I want to send the values from arbitrary indexes in that vector to other processors.
I can easily do this with Boost's send() functions if I want to send the whole vector, but I really only need to send a small portion of it. ...
I am in the process of trying to make an app that has most of its development done in Visual C++ 6.0 adhere to Windows theming, or to be precise the visual styles aspect of it. The application in question is a MFC application with the MBCS characterset. Getting theming to kick in in the first place required the InitCommonControlsEx(...);...
I am getting a bunch of linking errors while trying to link the release version of an executable(debug version does not have the same issue). Comparing the command line for the link does not reveal any issues.
there are broadly 2 types of errors neither of which I can get a handle on.
The first kind complains about a unresolved external...