c++

Is there a simple but powerful IDE for C/C++?

Possible Duplicate: C++ IDE for Linux? I'm looking for a suitable for me IDE for C/C++. I'd like not to use projects etc, the main idea that I've accustom is to compile a file (not build a project) and run a compiled program then. So things like code::blocks as well as M$ VC are not for me... well, there is FreePascal IDE that...

Why disable CObject's copy constructor and assignment

The MFC's root object CObject's copy constructor and assignment are disabled by default. In MSDN, there is a description The standard C++ default class copy constructor does a member-by-member copy. The presence of the private CObject copy constructor guarantees a compiler error message if the copy constructor of your cl...

Check file name is valid windows name

Hello I wanna check if my string is valid windows file path. I was searching around and it seems that there is no reliable method to do that. Also I checked boost filesystem library , and no obvious function exist to do this check , maybe something like is_valid_windows_name ...

assignment operator overloading problem

This issue has me confused. The first piece of code works fine without crashing, it assigns s1 to s2 perfectly fine. But the second group of code causes the program to crash. Anyone have any idea on why this is happening or what the problem could be? Code 1:(works) s1.add(10, 30, 25, "Test Screen", false); s1.add(13, 10, 5, "Nam...

memory footprint issue

Hi, I was just curious I have a binary executable file in unix around 9MB. is that considered a large memory footprint? the client will be calling this to generate some values and subsequently queue messages elsewhere. I am just curious who is one suppose to know how when is it too big a memory footprint for a program and then having...

Function Should Return Value Question

Given a function like so bool RequestStatus() { ... if (code == myCode) { return true; } else { return false; } } Why would the compiler complain that "Function should return value". Unless I am missing something, how else could it not return true or false? Is it because the value of myCode is runtime...

templates vs switch

Hi, I'm trying to find my ways in the C++ land and am increasingly confused by now. The toy application is a very basic OpenGL engine. So here's the (I guess simple) problem: I'd like to handle meshes of different vertex data, so I'd have e.g. struct Vertex { Vector3f position; } struct VertexN : public Vertex { Vector3f norma...

c++ qt quit on action

i got an action in my menu; connect(action, SIGNAL(triggered()), this, SLOT(action1())); but when i executed the function my program always exited. how to solve this? ...

error in one line Xerces program

The following application gives me an access violation on its first line, whats with that? // test.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <xercesc/util/XMLString.hpp> using namespace xercesc; int main() { XMLCh* path= XMLString::transcode("test.xml"); ...

function templates with class template typedef arguments

Hi, the following code is an example of something I'm trying to do in a large project: #include <iostream> #include <vector> // standard template typedef workaround template<typename T> struct myvar {typedef std::vector<T> Type;}; template<typename T> T max(typename myvar<T>::Type& x) // T max(std::vector<T>& x) { T y; y=*x.begin(...

Search a std::string

I'm looking to search a string for example: std::string str = "_Data_End__Begin_Data_End"; |_________| |_____________| data data section1 section2 If i'm searching for "Begin" in str i want to make sure that it does look in "data section2" if it wasn't found in "da...

C++ add linux user

Hello, Whats the best way to add a user/group in linux using C++ is there a library I can call on? I dont want to start doing things like: fopen("/etc/passwd", "a"); fprintf(tmp, "%s:x:%d:1:%s:/%s/%s:/bin/ksh\n", username, usernumber, commentfield, userdir, username); fclose(tmp); fopen("/etc/shadow", "a"); fprintf(stmp, "%s:*LK*::...

Help with WinAPI Toolbar

I'm trying to create a toolbar where my bitmaps will be 40x40 and I'm trying to make the toolbar 40 pixels in width. I want it to be a vertical toobar. I'm getting nothing but horizontal results from this code: HWND OGLTOOLBAR::create(HWND parent,HINSTANCE hInst,WNDPROC prc, int *toolWidthPtr) { if (toolhWnd != NULL) { r...

Connecting Oracle to code::blocks

I tried to connect a C++ program in codeblocks IDE to Oracle database. For that, I downloaded an API named SQLAPI. I took a given example in that API folder and compiled and linked the appropriate files. The code is : #include <stdio.h> // for printf #include <SQLAPI.h> // main SQLAPI++ header int main(int argc, char* argv[]) { SAC...

C++ Partial Ordering Fails with 2 Template Parameters

So given the following template functions with partial specialization template<typename T> void foo(vector<T> &in) { cout << "vector" << endl; } template<typename T> void foo(T &in) { cout << "scalar" << endl; } int main(int arc, char *argv[]) { vector<double> a; double b; foo(a); foo(b); return 0; } I h...

What algorithms to use for image downsizing?

What algorithms to use for image downsizing? What is faster? What algorithm is performed for image resizing ( specially downsizing from big 600x600 to super small 6x6 for example) by such giants as flash and silver player, and html5? ...

Socket pointer transfer of ownership with tcp::acceptor::async_accept

Hi all, I've recently started using Boost.Asio in a project and would like to know whether anyone knows a clean solution to transfer ownership of a newly created socket to tcp::acceptor::async_accept, which would in turn transfer this ownership to the accept handler function. This isn't an incoherent desire, mind you, since the handler...

What I am doing wrong with c++ maps? (scary memory errors)

I am new to C++ and I'm having trouble using a map correctly in class that I'm writing. Basically, when I make a new Block object in a test program and call its write method, the program totally shits itself and gives me a double free or corruption error. What is weird is that everything works fine if I uncomment that one line in the Blo...

finding some errors in making a toolbar using MFC

i added this in my header file CToolBar myBar; public: int OnCreate(LPCREATESTRUCT lpCreateStruct); void OnToolBarButton1(); void OnToolBarButton2(); and i added this in .cpp file BEGIN_MESSAGE_MAP(CtoolbarfDlg, CDialog) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CREATE() ON_COMMAND(IDC_TBBUTTON1...

stringstream was not declared in this scope

I'm having problem with stringstream.my visual studio nor linux g++ can understand stingstream. I've added sstream but it does'nt solve anything. I've worked with it before and really don't know what's up with it now? #include <sstream> #include <stdlib.h> #include "SymbolTable.cpp" #include "setjmp.h" using namespace std; jmp_buf *bfj;...