c++

Compiling CUDA examples gives build error

I am running Windows 7 64bit, with Visual Studio 2008. I installed the CUDA driver's and SDK. The SDK comes with quite a few examples including compiled executable and source code. The compiled executable's run wonderfully. When I open the vc90 solution's and go to build in Win32 configuration I get this error: Error 1 fatal error...

C++ Streams Not Reading Blank Line

Hi, I am trying to write a function that reads in individual lines from a txt file and stores them in a string array. The function works correctly except for when it reads in blank lines. Example: Function ifstream flinput( "somefile.txt" ) string line; while( getline(flinput, line) ) { //Add line to array So the problem is if th...

c++ data alignment /member order & inheritance

hi! how do datamembers get aligned / ordered if inheritance / multiple inheritance is used? Is this compilerspecific? is there a way to specify in a derived class how the members (including the members from the baseclass) shall be ordered / aligned? Thanks! ...

Print Hexadecimal Numbers Of a File At C And C++

I'm now developing a home project, but before I start, I need to know how can I printcout the content of a file(*.bin as example) in hexadecimal? I like to learn, then a good tutorial is very nice too ;-) Remember that I need to develop this, without using external applications, because this home project is to learn more about hexadeci...

Compiling Qt app agains latest VC++ 2008 runtime

Hi I have a problem compiling my Qt app with Visual studio 2008 SP1. For the sake of purity I created a windows XP virtual machine, installed VS 2008, then SP1 and then compiled Qt 4.6. Now from looking at the manifest of the Qt DLLs (using XN Resource Editor) I can see that they depends on 9.0.21022.8 CRT. But at the same time the lat...

Which would you prefer to have to maintain?

[To any mod considering deleting this question - please don't. Either my or Steve Jessop's code may well be helpful to reference from questions regarding reading text files using C.] This question has generated the usual amount of sound and fury re the relative merits of C and C++. But something that never seems to get introduced into t...

What does "exposition only" mean? Why use it?

All over boost.org and also at other sites on the web I've seen code of this form: class whatever { ... private: std::vector<std::string> m_name; // exposition only }; What is the meaning of "exposition only"? What is the comment's purpose? What is it trying to tell me? ...

Is there a GCC pragma to override generation of debug info (-g) for some section of code?

I'd like to include some debug information in an application, but hide certain symbols from appearing. Is there any way to do this with GCC 4.0 (or 4.2)? This is on OSX. ...

Can I link unresolved reference to abort?

I'm trying to write some small tests for a fairly small part of a fairly large project. Attempting to link this beast is unfortunately fairly impossible without linking the entire project together, which I don't want to do (it's a pretty complex system for finding all the dependencies and stuff, and I perfer not to meddle with it). Now,...

Determine excel 2003 print preview window programatically

Hello, Does anyone have any ideas of how I can programatically determine if the excel print preview window is open using c++? I've used spy to look at it, can't find anything sensible. thanks, H ...

C++ exception handling with source code line info

Is there a way catch an exception like access violation and get information about on which line an exception occurred? This would be very good for debugging purposes, especially for testers.. My environment is Windows with VC++ on VS2008 ...

a library forces global overloads of new/delete on me!

I'm maintaining a plugin (implemented as a dll) for a big closed source application. This has been working fine for years. However, with the latest update to it's SDK the vendor overloaded global operators new and delete. This causes lots of trouble for me. What happens is that my plugin allocates a string. I pass this string into a stat...

Create GStreamer XUL element?

I would like to create a custom XUL element named 'video' for a video editing application based on XULRunner. In the XPCOM documentation it is explained how to access your component from Javascript, but I can't seem to find any documentation on how to declare a new XUL element. Where can I find this? Can anyone point me in the right dire...

Deprecated functions not spotted if using "System::Threading::ThreadState" (and others!) C++ VS2005/2008

Hi, I'm facing an issue with c++ on vs2005 and also vs2008... here's how you can reproduce the issue.... create a new (c++) project called 'test' (file|new|project) select "Windows Forms Application" and add the 'stdio.h' include and the code fragment below into the test.cpp source file..... -------------------start of snippet-------...

Is there an equivalent to the C# "var" keyword in C++/CLI ?

In C#, I like the var keyword for situations like this: var myList = new List<MyType>(); Is there any equivalent in C++/CLI, or do I have to repeat the type name everytime just like this: List<MyType ^>^ myList = gcnew List<MyType ^>(); Could not find an explicit statement in the docs or by Google so far. I am using Visual Studio 2...

Socket select() works in Windows and times out in Linux

I'm porting a windows network application to linux and faced a timeout problem with select call on linux. The following function blocks for the entire timeout value and returns while I checked with a packet sniffer that client has already sent the data. int recvTimeOutTCP( SOCKET socket, long sec, long usec ) { struct timeval timeout;...

Suspend and resume the main thread in C++ for Windows

I need to be able to suspend and resume the main thread in a Windows C++ app. I have used handle = GetCurrentThread(); SuspendThread(handle); and then where is should be resumed ResumeThread(handle); while suspending it works, resuming it does not. I have other threads that are suspended and resumed with no problems, is there somet...

dlmalloc + CPP + strdup + Mac OS X = crash

I am using the dlmalloc library on Mac OS X in a mixed C/C++ environment. The following simple code /// strdup-test.cpp /// #include <iostream> #include <string> int main(int argc, char **argv) { std::string s1("foo"); char *c1=strdup(s1.c_str()); std::cerr << c1 << std::endl; // segfault? free(c1); return 0; } wh...

Is it possible to print out the size of a C++ class at compile-time?

Is it possible to determine the size of a C++ class at compile-time? I seem to remember a template meta-programming method, but I could be mistaken... sorry for not being clearer - I want the size to be printed in the build output window ...

C++ interface for hdiutil on Mac

Does a system call or library exist that would allow my C++ code to use hdiutil on Mac OS X. My code needs to mount an available .dmg file and then manipulate what's inside. ...