c++

C++ Cross Compiler throws STL related errors, Host Compiler works fine

I've built a GCC cross-compiler for arm, and I can prove it works in both trivial cases (Hello World), and in more serious uses (I've successfully cross compiled several libraries, most recently libjpeg). However, I'm trying to compile a particular file into an object file, which compiles fine using my x86 GCC, but yields the following ...

connecting a function to a boost::signal runs, but doesn't call the function

I have a class Yarl in my code with a member function refresh that I want to bind to two boost::signals. One of these signals is a member of a class EventHandler defined like this: class EventHandler { public: boost::signal<void()> sigRefresh; }; The other is a free floating signal in another file declared like this: nam...

How to join in a WMI Query (WQL)

I want to get the serial number of the boot-harddisk via a WQL query. The boot-partition can be retrieved using the following query: SELECT * FROM Win32_DiskPartition where BootPartition=True The serial number is in Win32_DiskDrive: SELECT DeviceID, SerialNumber FROM Win32_DiskDrive Win32_DiskDriveToDiskPartition has the mapping o...

Register keyword in C++

Possible Duplicate: register keyword in C? What is difference between int x=7; and register int x=7; ? I am using C++. ...

Need Help Creating Multiple Directories in Makefile

I have the following block of code in a makefile: param_test_dir: @if test -d $(BUILD_DIR); then \ echo Build exists...; \ else \ echo Build directory does not exist, making build dir...; \ mkdir $(BUILD_DIR); \ fi @if test -d $(TEST_DIR); then \ echo Tests exists...; \ else \ echo Tests directory does not e...

How to get rid of label used but not defined

I'm trying to print the rows of a table in embedded sql. I have this code where publication is the table and pubid is the attribute. I tried this: EXEC SQL DECLARE C1 CURSOR FOR SELECT pubid FROM publication; EXEC SQL OPEN C1; EXEC SQL WHENEVER NOT FOUND GOTO close_c1; for(;;) { EXEC SQL FETCH C1 INTO :pubid; ...

Fastest factorial implementation with 64-bit result in assembly.

This is not homework, just something I though of. So, straight computing factorial is not exactly fast; memoization can help, but if the result is to fit into 32 or 64 bits, then the factorial only can work for inputs 0 through 12 and 20 respectively. So ... we might as well use a lookup table: n n! 0 1 1 1 2 2 ...

How to write programmatically some unicode text in RTF format?

In order to generate RTF programmatically I have decided to use rtflib v1.0 from codeproject.com. But I can't understand how to generate text in russian unicode. So I need to generate a unicode text. Could someone help me? P.S. Honeslty, I could write in .rtf file some text in, only by opening it with MS Word. But after writeing some te...

C++: Best way to copy a section of a large array into a smaller one?

I have a situation where I will need an amount of memory determined at runtime to pass to a function. I am using a larger buffer on the stack, then only creating on the heap the space that is necessary: Foo largeBuf[1024]; int sizeUsed = fillBuff(largeBuf, 1024); Foo* smallerBuf = new Foo[sizeUsed]; for (UINT i = 0; i < sizeUsed; i++...

Java vs. C++ for building a GUI which has a C++ backend.

Hello, I currently have a C++ backend that I need to connect with a GUI, and since I've never built a GUI before, I was confused on where to start. I'm comfortable writing code in C++ and Java, so I'd prefer my GUI to be in one of those languages. Also, the GUI has to be reasonably OS independent over Windows and Linux (and hopefully,...

Simple noob I/O question (C++)

Hi, sorry for the noob question, but I'm new to C++. I need to read some information, line-by-line, from a file, and perform some calculations, and output into another file. For example, we read a unique ID for each line, a name, and 2 numbers. The last 2 numbers are multiplied, and in the output file, the ID, name and product are print...

What is the most efficient way to convert STL string array to const char* array?

We have: std::string string_array[2]; string_array[0] = "some data"; string_array[1] = "some more data"; char* cstring_array[2]; What is the most efficient way to copy data from string_array to cstring_array? Or pass string_array to the function, needed "const char* cstring_array[]"? ...

Running executable from VS2008 crashes with error "Application was unable to start correctly (0x000007b)" x64

This error is present in both Debug/Release. So the original problem was that it had 32 bit library that I did not link to 64 version of it. (Previous version of this question) I fixed that. And application works on Windows Server Standard 2008R2 x64. I tried running application on Windows Server Enterprise but got above (title) menti...

Best way to create windows applications.

I have been learning windows API from online and PDF books but I hear of people using sdk and visual studio programs. What should i do? API I'd create but extremely complex. Would I benefit from learning the API or should I get a sdk or program that writes to code for me? I have msc++e but I don't think it comes with those benifts ...

Use fprintf to memory stream

I have a vc++ method that uses fprintf to write values to a file in the hard disc. I want to change this method so that instead of writing the values to disc, I want to return a pointer to the data. I know in advance the size I have to allocate. Is there any way to pass a memory stream or unsigned char pointer to fprintf? thanks ...

An onsite implementation question from a startup.

The system maintains a table with 150 pages, and each page contains 1.5 million records hashed with users’ birth date. Each record includes information of username, nickname, birth date, hometown and title. We are required to write a C++ program that transforms this table into another one, which has 100 pages and is hashed with username....

Makefile Makeover -- Almost Complete, Want Feedback

Hi Everyone, I've been heavily refactoring my makefiles, with help from Beta, Paul R, and Sjoerd (thanks guys!). Below is my STARTING product: #Nice, wonderful makefile written by Jason CC=g++ CFLAGS=-c -Wall BASE_DIR:=. SOURCE_DIR:=$(BASE_DIR)/source BUILD_DIR:=$(BASE_DIR)/build TEST_DIR:=$(BASE_DIR)/build/tests MAKEFILE_DIR:=$(BASE_D...

how do I insert a string datetime into mysql using c++

I have a datetime field in the following format: string date = "Jun 23 19:47:15 +0000 2010"; how do I insert it ito datetime field in mysql table? I am assuming I have to convert the date into unix timestamp before I insert it into the table. ...

What are the shortcomings of std::reverse_iterator?

The documentation for boost's specialized iterator adaptors states that boost::reverse_iterator "Corrects many of the shortcomings of C++98's std::reverse_iterator." What are these shortcomings? I can't seem to find a description of these shortcomings. FOLLOW-UP QUESTION: How does boost::reverse_iterator correct these shortcomings? ...

How can I cin and cout some unicode text?

I ask a code snippet which cin a unicode text, concatenates another unicode one to the first unicode text and the cout the result. P.S. This code will help me to solve another bigger problem with unicode. But before the key thing is to accomplish what I ask. ADDED: BTW I can't write in the comman line any unicode symbol when I run the ...