c++

How to link against boost.system with cmake

...

Using Boost::asio in Winx64: I'm stuck, need to figure out how to build libboost_system_xxxx.lib for x64

Unlike this question: http://stackoverflow.com/questions/704294/linker-error-while-building-application-using-boost-asio-in-visual-studio-c-200 I need an x64 build of the lib files... I'm not even sure how to get started. I'm reading here: http://www.boost.org/doc/libs/1_39_0/more/getting_started/windows.html Or, more generally, how ...

C/C++ initialization of a normal array with one default value

http://www.fredosaurus.com/notes-cpp/arrayptr/array-initialization.html 1: Page above has a nice list over initialization of arrays. So I have a int array[100] = {-1}; expecting it to be full with -1's but its not, only first value is and the rest are 0's mixed with random values. The code int array[100] = {0}; works just fine a...

Should boost::filesystem::exists really throw an exception for removable media device with no media?

I've run into a bit of an odd circumstance while using boost::filesystem::exists. If you attempt to check for the existance of a file on a drive that isn't ready or has no media in it, it throws a basic_filesystem_error. As far as I'm concerned for most all uses of bfs::exists, if a drive isn't ready it means the file doesn't exist. I...

Boost linker error: Unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::get_system_category(void)"

I'm just getting started with Boost for the first time, details: I'm using Visual Studio 2008 SP1 I'm doing an x64 Build I'm using boost::asio only (and any dependencies it has) My code now compiles, and I pointed my project at the boost libraries (after having built x64 libs) and got past simple issues, now I am facing a linker erro...

What is the Preferred Cross-platform 'main' Definition Using boost::program_options?

I'm trying to develop a cross-platform application using C++ with boost. I typically program in a *nix environment, where I've always defined 'main' as follows: int main( const int argc, const char* argv[] ) { ... } For this application, I'm starting in the Windows environment, using Visual Studio 2003. When I try to use boost::pro...

QWinWidget Inside MFC Dialog Not Repainting or Responding to Tab/Arrow keys

I am using a QWinWidget inside of an MFC dialog and the QWinWidget is not drawing itself correctly and it is not handling keyboard input correctly. Repainting [Unsolved] Within the QWinWidget, I have a QTableWidget. When I scroll the QTableWidget, it does not redraw itself until I stop scrolling, at which point it redraws everything. S...

Using DXUTSetWindow in a MFC Direct3D application

I've been experimenting with the DXUT functions for Direct3D applications in the March 2009 DirectX SDK. They seem to have many useful features including auto detection of DirecX10 or DirectX9 and window management features that bypass a lot of the tedious window management tasks generally required by Direct3D. However, I'm having a pr...

How to iterate over a STL map full of strings in C++

I have the following issue related to iterating over an associative array of strings defined using std::map. -- snip -- class something { //... private: std::map<std::string, std::string> table; //... } In the constructor I populate table with pairs of string keys associated to string data. Somewhere else I have a method toS...

vs 2008 deployment project not working

I have a C++ console application that I want to deploy using a vs2008 setup project. When I create the setup project and add the output from my console app, the setup project detects that it needs MSVCP90.dll and MSVCR90.dll. When I build the project, those two dlls are included in the .msi file as expected. When I download and launch t...

Is C or C++ better for making portable code?

I am trying to have some fun in summer. Writing a piece of code that enables presenting Arabic language in systems that support Unicode but no support for eastern languages it. I am writing only the logic hopefully with no integration code initially. Should I use C++ or C? Which is the easier language to write portable code and easier...

Compilation errors through incorrect use of CComPtr objects

I have defined the following CComPtr object and method in my class: private: CComPtr<IRawPdu>& getRawPdu(); // Returns the RawPdu interface pointer from the mRawPdu data member. // mRawPdu is initialized, if necessary. CComPtr<IRawPdu> mRawPdu; // Initialized to 0 in the ctor. Uses lazy evaluation via getRawPdu()....

C++ XML comments to generate MSDN style CHM

I have several projects, some using managed code and some using only unmanaged. All have the XML comments have been added and the XML documentation is being generated correctly (the generated xml file and intermediate the xdc files). Surely there's something that can take these files (the output of xdcmake) and generate MSDN style chm h...

C/C++ testing framework (like JUnit for java)

Been hitting my head on the wall before as I don't make any test classes while using c/c++ (but instead have a lot of print methods). What is the most used method to perform testing in the c/c++ code? Java's JUnit has only left me with good memories while debugging things. I know that using asserts in code with a defined debug header ...

Generate C wrapper from C++?

Hi, I want to generate C wrappers from C++ libraries. There are tutorials on how to do it by hand: http://developers.sun.com/solaris/articles/mixing.html http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html http://yosefk.com/c++fqa/mixing.html But it is too much of a manual labor. For example, for this: struct RtAudio { ...

Alternatives to dlsym() and dlopen() in C++

Hi all, I have an application a part of which uses shared libraries. These libraries are linked at compile time. At Runtime the loader expects the shared object to be in the LD_LIBRARY_PATH , if not found the entire application crashes with error "unable to load shared libraries".Note that there is no guarantee that client would be hav...

How to append the contents of one map to another map?

I have two maps: map< string, list < string > > map1; map< string, list < string > > map2; I have populated map1, now I want to copy the map1 contents into map2. So I simply did: I have some operation for that the map1 fills with 1. kiran, c:\pf\kiran.mdf, c:\pf\kiran.ldf 2. test, c:\pf\test.mdf, c:\pf\test.mdf And now I have t...

Custom-typed Reference members in C++ - initialising them

Hi all, this snippet of code is given me headache. Personally, I would like to use reference as they are neater compared to pointer, so I tried this: include "SomeClass.h" class FooBar { private: SomeClass& member_; public: FooBar() : member_(SomeClass()) { }; } I have read that you need to assign a temp variable to...

Pass an unary predicate to a function in C++

I need a function which stablishes for my class a policy for displaying items. e.g: SetDisplayPolicy(BOOLEAN_PRED_T f) This is assuming BOOLEAN_PRED_T is a function-pointer to some boolean predicate type like: typedef bool (*BOOLEAN_PRED_T) (int); I'm interested only on e.g: display something when the passed predicate is TRUE, do n...

Import Makefile settings to VS2005 IDE

Hi, I'm a newbie in this vast world of programming. I've been given some codes in C which are compiled & linked using makefile. I can compile the code using nmake from VS2005. Now i want to build the program in C++ VS2005 IDE. From a quick google search, there seems to be no automated functions in importing makefile settings to VS IDE. ...