c++

Obtaining the Button Clicked after a Clicked() is emitted in Qt (C++)

Hello everyone, I was wondering, once a clicked() is emitted by a button is there any way of finding out what button emitted it without overloading the click() function? (I have a bunch of buttons with almost the same function but different text, which is the defining element of each button). Thanks in advance! ...

Problem with "not declared in this scope" error

I've got: error a1 was not declared in this scope Can somebody please explain why this code causes that? quiz.h #ifndef QUIZ_H_ #define QUIZ_H_ #include "quiz.cpp" // I deleted this row // and wrote void quiz(int i); class A { private: int player; public: A(int initPl...

How to run multiple arguments in Cygwin

I've been trying to run a program that will invert the order of a string and to run it, I have to type a second argument in prompt. int main(int argc, char* argv[]) { string text = argv[2]; for (int num=text.size(); num>0; num--) { cout << text.at(num); } return 0; } e.g. ./program lorem result: me...

C++ multiple definition error

Starting with sth's answer to this question: http://stackoverflow.com/questions/3023760/c-template-specialization I was wondering how to resolve multiple definition errors if the following code is put in a header file included multiple times by different .cc files and linked together: template <typename T> class C { static const ...

Exceptional C++[Bug]?

I have been reading Exceptional C++ by Herb Sutter. On reaching Item 32 I found the following namespace A { struct X; struct Y; void f( int ); void g( X ); } namespace B { void f( int i ) { f( i ); // which f()? } } This f() calls itself, with infinite recursion. The reason is t...

How to fit a custom graph to the boost graph library template?

I'm rusty on C++ templates and I'm using the boost graph library (a fatal combination). I've searched the web and can't find any direct instructions on how to take a custom graph structure and fit enough of it to BGL (boost graph library) that I can use boosts graph traversing algorithms. Anyone familiar enough with the library to help m...

What does 'Conditional expressions can be only boolean, not integral.' mean?

What does 'Conditional expressions can be only boolean, not integral.' mean? I do not know Java and I know C++ deffenetly not enought to understend what it means.. Please help (found in http://www.javacoffeebreak.com/articles/thinkinginjava/comparingc++andjava.html in Comparing C++ and Java item 7 sub item 1) ...

Learn C++ after learning C#

I'm developing a library in C# at the moment and recently bought a great book to help me out but the code snippets are in C++. Does anyone have a link to a site/PDF that'll give me a crash course in C++? (mainly the syntax rather than pros/cons etc) because I'll be developing in C# but things like ->, ::, &, **, are giving me the shive...

Modifying documents in memory in yaml-cpp

I want to read a YML document, filter it by modifying some nodes in memory, and then spit it back out with an emitter. The problem is that YAML::Node appears to be designed to be read-only. Is there a way to replace a node's value (with a scalar in this case) that I'm missing? ...

Why not put all braces inline in C++, C#, Java, javascript, etc.?

Of all the conventions out there for positioning braces in C++, C#, Java, etc., I don't think I've ever seen anyone try to propose something like this: public void SomeMethod(int someInput, string someOtherInput) { if (someInput > 5) { var addedNumber = someInput + 5; var subtractedNumber = someInput - 5; } else ...

boost::unordered_map is... ordered?

I have a boost::unordered_map, but it appears to be in order, giving me an overwhelming feeling of "You're Doing It Wrong". Why is the output to this in order? I would've expected the underlying hashing algorithm to have randomized this order: #include <iostream> #include <boost/unordered_map.hpp> int main() { boost::unordered_map<...

Boost::asio::endpoint::size() and resize()

hi. I was reading the boost endpoint documentation and saw size() and resize() member funcs. the documentation says: Gets the underlying size of the endpoint in the native type. what does this size represent and where can it be used/resized ? thanks. ...

What Parallel computing APIs make good use of sockets?

My program uses sockets, what Parallel computing APIs could I use that would help me without obligating me to go from sockets to anything else? When we are on a cluster with a special, non-socket infrastructure system this API would emulate something like sockets but using that infrastructure (so programs perform much faster than on soc...

C++ vector and struct problem win32

I have a structure defined in my header file: struct video { wchar_t* videoName; std::vector<wchar_t*> audio; std::vector<wchar_t*> subs; }; struct ret { std::vector<video*> videos; wchar_t* errMessage; }; struct params{ HWND form; wchar_t* cwd; wchar_t* disk; ret* returnData; }; When I try to add my video structure to a vecto...

How do I correlate build configurations in dependant vcproj files with different names?

I have a solution file that requires a third party library (open source). The containing solution uses the typical configuration names of "Debug" and "release". The 3rd party one has debug and release configs for both DLL and static libs - their names are not "Debug" and "Release". How do I tell the solution to build the dependency fi...

protocol buffers with C++ client and C# back-end?

How do you connect C# back-end with a C++ front-end via HTTP or web-service equivalent? ...

Specializing a template member function of a template class?

I have a template class that has a template member function that needs to be specialized, as in: template <typename T> class X { public: template <typename U> void Y() {} template <> void Y<int>() {} }; Altough VC handles this correctly, apperantly this isn't standard and GCC complains: explicit specialization in non-...

How do you switch to "Use MFC in a Static Library" and get rid of the errors

I am working on a project i inherited form a previous team and am attempting to build the project in release mode in Microsoft Visual Studio 2008. I need to get the program to compile with "Use MFC in a Static Library" in the properties window instead of "Use MFC in a Shared DLL" I keep getting a number of errors which are displayed belo...

C++ and CLR Stored Procedures

Does anybody know if possible to run a CLR SQL Server Stored Procedure in c++? And if you could provide sample code on how to call a CLR stored procedure. Note: I do not mean managed c++ aka C++ CLR Example) http://msdn.microsoft.com/en-us/library/5czye81z(VS.80).aspx ...

How do I convert byte to string?

Hello! Is there any fast way to convert given byte (like, by number - 65) to it's text hex representation? Basically, I want to convert array of bytes into (I am hardcoding resources) their code-representation like BYTE data[] = {0x00, 0x0A, 0x00, 0x01, ... } How do I automate this Given byte -> "0x0A" string conversion? ...