c++

Why compile + link when build a C++ code, instead of generating executable directly

I was asked of this question when mentor an entry-level programmer, I was thinking of this compile + link process so official and usual that I never think about why. One thing I could think of is to improve the development productivity, but should there be any other more compiler-related reasons? ...

Can anyone explain why my crypto++ decrypted file is 16 bytes short?

In order that I might feed AES encrypted text as an std::istream to a parser component I am trying to create a std::streambuf implementation wrapping the vanilla crypto++ encryption/decryption. The main() function calls the following functions to compare my wrapper with the vanilla implementation: EncryptFile() - encrypt file using my...

Link compatibility between C++ and D

D easily interfaces with C. D just as easily interfaces with C++, but (and it's a big but) the C++ needs to be extremely trivial. The code cannot use: namespaces templates multiple inheritance mix virtual with non-virtual methods more? I completely understand the inheritance restriction. The rest however, feel like artificial limi...

What does int argc, char *argv[] mean?

In many C++ IDE's and compilers, when it generates the main function for you, it looks like this: int main(int argc, char *argv[]) When I code C++ without an IDE, just with a command line compiler, I type: int main() without any parameters. What does this mean, and is it vital to my program? ...

Boost Binary Serialization Problem

Hi all, I have a problem using boost serialization using binary archives. It works when using a file stream but I want to store it in my local variable and ultimately save/load it to/from berkeley db. When executing the program I get a *boost::archive::archive_exception*: 'stream error' when instantiating the *binary_iarchive*. #inclu...

Which directories does include statement search in C/C++?

test.c: #include "file.h" In the above statement, which directories will be searched ? I suppose the directory where test.c locates will be searched, right? But is that all? BTW, what's the benefit to use a header file? Java doesn't require a header file... ...

What's a good C++ project to read through and learn from?

Possible Duplicates: What C++ open-source projects have good and clean code to learn from? Code reading: where can I read great, modern, and well-documented C++ code? I'm looking for something readable with good OO design, in the medium size-range. I'd call myself an advanced beginner in OO programming, and I'm hoping to f...

Confusion about pointers and their memory addresses

alright, im looking at a code here and the idea is difficult to understand. #include <iostream> using namespace std; class Point { public : int X,Y; Point() : X(0), Y(0) {} }; void MoveUp (Point * p) { p -> Y += 5; } int main() { Point point; MoveUp(&point); cout << point.X << point.Y; return 0; } Alrigh...

C++ Preprocessor Decisions

Sorry I know this is basic, but perhaps it doesn't exist or I'm not googling the right words is there and a if not (is that ifndef?) an AND and an OR? so I could do something like if not DEBUG and MACOS thanks ...

mysql-connector-c++ - ‘get_driver_instance’ is not a member of ‘sql::mysql’

I am a beginner at c++ and figured the only way I am going to learn is to get dirty with some code. I am trying to build a program that connects to a mysql database. I am using g++, on linux. With no ide. I run "make" and this is my error: hello.cpp:38: error: ‘get_driver_instance’ is not a member of ‘sql::mysql’ make: *** [hello.o] Er...

Matrix "Zigzag" Reordering

I have an NxM matrix in Matlab that I would like to reorder in similar fashion to the way JPEG reorders its subblock pixels: (referenced from here) I would like the algorithm to be generic such that I can pass in a 2D matrix with any dimensions. I am a C++ programmer by trade and am very tempted to write an old school loop to accomplis...

C++ code coverage tool

I am looking for c++ code coverage tool which fares well in mutli server setup and on both windows and linux without licensing issues(if non free). I have done some research and found 2 free tools: Covtool and gcov. Any disadvantages on these or any other suggestions? ...

C++ Draw program, split in groups of two

I would like to make a draw application. I want to enter user names until eg "end" is entered and then the program to split them in groups of two. Can you suggest any examples? I don't know how to start! If possible, I want to be Cross-platform. If it isn't possible I want linux. ...

allow debugger to hook instance of application launched externally?

I'm trying to test problems with an MFC application that still uses DDEEXEC mechanism for handling shell verbs (e.g. "open"). I cannot seem to find a way to cause the debugger to hook the application instance the second its created (or at a point of my choosing) when it's launched from the Windows shell. For example, if I were to double...

Options for open source front end for C++

I am looking for options for an open source C++ compiler front-end (source parser/analyzer) that I could customize for my requirements. I do not need the back end implementation, just that it would help to find a fast and relatively bug free C++ front end that supports most standard features. Any suggestions? [I did google, clang seems...

[C++/general] parser with scopes and conditionals

I'm writing a C/C++/... build system (I understand this is madness ;)), and I'm having trouble designing my parser. My "recipes" look like this: global { SOURCE_DIRS src HEADER_DIRS include SOURCES bitwise.c \ framing.c HEADERS \ ogg/os_types.h \ ogg/ogg.h } lib static ogg_static { ...

Scalability of Boost.Asio

I'm curious how far others have pushed Boost.Asio in terms of scalability. I am writing an application that may use close to 1000 socket objects, a handful of acceptor objects, and many thousand timer objects. I've configured it such that there's a thread pool invoking io_service::run and use strands in the appropriate places to ensure ...

Rvalues in C++03

How can you tell whether or not a given parameter is an rvalue in C++03? I'm writing some very generic code and am in need of taking a reference if possible, or constructing a new object otherwise. Can I overload to take by-value as well as by-reference and have the rvalue returns call the by-value function? Or do I have a very sickenin...

how to convert char * to uchar16 in JNI C++

Hello, here's what I am trying to do: typedef uint16_t uchar16_t; uchar16_t buf[32]; // buf will contain timezone information like GMT-6, Eastern Daylight Time, etc char * str = "Test"; for (int i = 0; i <= strlen(str); i++) buf[i] = str[i]; I guess that's not correct since uchar16_t would contain 2 bytes and str contains 1 ...

What are these c++ statements doing

void useproxynum ( ) { bUseProxy = true; return; }; void useacctnum ( ) { bUseProxy = false; return; }; Can anyone give me some insight into what these c++ statements are doing? There are in a header file. bUseProxy is defined above bool bUseProxy; I'm trying to figure out what useproxynum is (method call?) and I'm also t...