c++

How to use OpenGL and GLUT in Cygwin

I've attempted to follow the instructions from various places [1][2][3], but I keep getting link errors when attempting to use GLUT and OpenGL in Cygwin. Everything I try gives me a link error similar to: $g++ -Wall -pedantic -c -o triangle.o triangle.cpp $g++ -o triangle *.o -lglut32 -lglu32 -lopengl32 -o triangle triangle.o:triangle....

Lua or Python binding with C++

I have used Lua.NET on .NET platform and I could call the .NET class/object from Lua and I could call the Lua from .NET Lua API interface. I did the same with the IronPython. I knew the how the .NET binding works. Now I have a C++ project and I want to use the dynamic capabilities. I want to call C++ object which may not be possible fr...

Get post data from page

I've faced with problem i need to get content from site but before i need authorize. Now i looking for library(or some kind of this stuff) to parse all post data (i try use regex but i searching for alternative) ...

C++ References Puzzle: My output appears reversed. Why?

The output of the following code is "321" without quotes. Why not "123"? #include <iostream> using namespace std; int& inc(int& start) { return ++start; } int main() { int i = 0; cout << inc(i) << inc(i) << inc(i) << endl; } ...

Including header files in VS2005

How do you include header files from top-level and sub-directories in c++? ...

Adjusting tab width in C++

Is there any way to adjust tab width in the console? ...

How can I build a lookup table in C++?

I am a complete novice in C++. I am trying to read a file and build a lookup table (more like a hashtable just to check the existence of a string value). The file has about 300 thousand entries that I will use to build a lookup table. And after this, I will be performing some 1 million lookups on this. What is the most efficient way of d...

Discard ALT key press in CMainFrame

I'm having the following code: CMainFrame* pFrame = new CMainFrame; if (!pFrame) return FALSE; m_pMainWnd = pFrame; // create and load the frame with its resources pFrame->LoadFrame(IDR_APP_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL); // The one and only window has been initialized, so show and update it pFr...

Java program with 2 native methods declared and defined in C and C++

Can anyone give me an example of a Java program which has two native methods declared and defined in C and C++. Actually, I need a procedure as well as the code, so that I can run it and learn from it, thanks. ...

Another way to use continue keyword in C++

Recently we found a "good way" to comment out lines of code by using continue: for(int i=0; i<MAX_NUM; i++){ .... .... //--> about 30 lines of code continue; ....//--> there is about 30 lines of code after continue .... } I scratch my head by asking why the previous developer put the continue keyword inside the intensive loo...

Intrusive or non intrusive

I am writing a multi threaded server app that requires stability and high performance. I'm looking at using Boost for some data structures I need. Is an intrusive data structure better or worse for something that should be thread safe and needs fast access, insertion, etc:::: ? ...

Where did the datatypes get their name from?

Why is a bit, called a bit. Why is a 8-bits a Byte? What made people call a 16-bits a Word, and so on. Where and why did their alias come about? I would love other people to include things like basic ASM types, then branch out to C/C++ and move on to SQL and the like's datatypes. 1-Bit Bit - binary Unit Bool - Named after the invento...

Undefined reference to `RPositionServer::RPositionServer()`

Hi everyone, i'm writing program for Nokia 5230 (S60 5th edition platform) using Nokia Qt SDK. I have the problem with retrieving geolocation info. I'm trying to use example from nokia forum (http://bit.ly/be3QDK first one). The following code: #include <lbs.h> #include <lbsrequestor.h> #include <lbscommon.h> #include <lbsposition.h> #i...

What is the main difference in object creation between Java and C++?

I'm preparing for an exam in Java and one of the questions which was on a previous exam was:"What is the main difference in object creation between Java and C++?" I think I know the basics of object creation like for example how constructors are called and what initialization blocks do in Java and what happens when constructor of one cl...

Cross Reference and Passing the This Pointer between Classes [NS2/C++]

------------ ------------ | TclObjct | | Handler | ------------ ------------ |__________________________________| | -------------- ...

Linking to a Library requires MFC80U.LIB

I am trying to compile the SkpWriter example from the latest SketchUp C++ SDK. However, the linker gives me LNK1104 saying that "mfc80u.lib" could not be found since one of the static libraries (Utils.lib) in the SDK depends on some MFC 8 libraries. I am using VS2008 and only mfc90u.lib is available. Is there a way to use mfc90u.lib in ...

Class Private members modified on creating a structure (C++)

I was just going through some codes of C++. Where in I came across the concept of reinterpret_cast operator. EDIT 1 : I know that accessing private members of a class is not recommended. But in some situations we ought to go ahead and access them. I have just put forth this question to get my concepts clear. In the example that I re...

Compiling & linking multiple files in C++

One of my "non-programmer" friends recently decided to make a C++ program to solve a complicated mechanical problem. He wrote each function in a separate .cpp file, then included them all in the main source file, something like this: main.cpp: #include "function1.cpp" #include "function2.cpp" ... int main() { ... } He then compile...

What C++ IDEs on Linux have "intellisense" in par with, or better, than Visual Studio?

There are some Linux based C++ projects in the pipe. What IDEs should I go for that have some kind of "intellisense" in par with, or better, than the one of a bare Visual Studio (that is, without the Visual Assist steroids). (Note that I didn't use the words "as good as, or better". I consider the Visual Studio C++ intellisense everythi...

ifstream::unget() fails. Is MS' implementation buggy or is my code erroneous?

Yesterday I discovered an odd bug in rather simple code that basically gets text from an ifstream and tokenizes it. The code that actually fails does a number of get()/peek() calls looking for the token "/*". If the token is found in the stream, unget() is called so the next method sees the stream starting with the token. Sometimes, see...