c++

Can I separate C++ main function and classes from Objective-C and/or C routines at compile and link?

I have a small C++ application which I imported Objective-C classes. It works as Objective-C++ files, .mm, but any C++ file that includes a header which may end up including some Objective-C header must be renamed to a .mm extension for the proper GCC drivers. Is there a way to write either a purely C++ wrapper for Objective-C classes ...

Should I use a single header to include all static library headers?

Hello, I have a static library that I am building in C++. I have separated it into many header and source files. I am wondering if it's better to include all of the headers that a client of the library might need in one header file that they in turn can include in their source code or just have them include only the headers they need? ...

Mixed I/O operations on single socket

Hi, I am thinking to write a simple wrapper class for socket in C++. I wonder if there is a need to have concrete class specific to I/O type, such as TcpSyncSocket and TcpAsyncSocket. Thus I would like to know how often do you guys find yourself in need to have mixture of both kind I/O operations on single socket. While I do not have ext...

Is C++ built on top of C ?

Does C++ code gets converted to C before compilation ? ...

#pragma once equivalent for Codegear RAD Studio

Is there anything equivalent to #pragma once for Codegear RAD Studio 2009? I am using the precompiled header wizard and I would like to know if it is still necessary to use include guards when including header files? ...

Using 7-zip via system() in c++

I'm trying to use 7-Zip to zip up a file via the system() function in C++ on a windows XP machine. I tried: (formatted to be what system() would have received) "C:\Program Files\7-Zip\7z.exe" a -tzip "bleh.zip" "addedFile.txt" which spat the error 'C:\Program' is not recognized as an internal or external command, operable program or ...

Need insight into how manifest is being generated for C++ program

When I run an executable that I built, I get the following error: The system cannot execute the specified program My immediate thought was that it was a dependency problem with one of the VC8.0 re-distributable DLLs (msvcr80d.dll et al.). We have had a few problems with patched versions of these DLLs affecting our programs. When I...

Texturing Not Working

I am using code from this site: http://www.spacesimulator.net/tut4_3dsloader.html It works in their example project but when I placed the code into a class for easier and more modular use, the texture fails to appear on the object. I've double checked to make sure the texture ID is correct by debugging them side by side. On my project ...

Is it okay to use "delete this;" on an object that inherits from a Thread class?

In general, if you have a class that inherits from a Thread class, and you want instances of that class to automatically deallocate after they are finished running, is it okay to delete this? Specific Example: In my application I have a Timer class with one static method called schedule. Users call it like so: Timer::schedule((void*)o...

Threadsafe logging inside C++ Shared library

I have implemented multithreaded shared library in C++ (For Linux and Windows). I would like to add logging mechanism inside the library itself. The caller of the library is not aware of that. The log file would be same so i am wondering how could i design the thread safe logging if multiple process is using my library and trying to open...

How do you have a window that has no icon in the tasktray?

I found the windows style WS_EX_TOOLWINDOW but this changes the title bar. Is there a way to not have the tasktray icon but keep the normal window titlebar? ...

What if a constructor parameter has the same name as a member variable in C++?

Some code first: class CInner { public: CInner( const CInner& another ) { //impl here } private: // some member variables } class COuter { public: COuter( const CInner& inner ) : inner( inner ) {} private: CInner inner; } Yes, in COuter::COuter( const CInner& ) the parameter has the same name as the member variable. ...

In C++ how is function overloading typically implemented?

If there is no function overloading, the function name serves as the address of the function code, and when a function is being called, its address is easy to find using its name. However with function overloading, how exactly can the program find the correct function address? Is there a hidden table similar to virtual tables that stores...

How can I dump a MySQL database from mysql c library.

I want to archive my database of mysql. Kindly give me some guide lines how I can make it possible, I am using mysql c library for insertion and selection etc. I dont know how to use dump command. ...

Ncurses User Pointer

I'm trying to learn ncurses, and I'm reading the terrific guide here, but the example at user pointers does not compile. I get this error when I try to compile. menu.cpp: In function 'int main()': menu.cpp:44: error: invalid conversion from 'void (*)(char*)' to 'void*' menu.cpp:44: error: initializing argument 2 of 'int set_item_use...

How to use Loki's Pimpl implementation?

Link to source code of Loki Pimpl header. I am not able to find any documentation on how to use the same, can any one explain how to use. And what does the following function in the header do. PimplOwner ImplOf PimplOf RimplOf ...

C++ templates problem

I am new to templates in c++. i was trying some small programs. CPP [80]> cat 000001.cpp 000001.hpp #include <iostream> #include <string> #include "000001.hpp" int main() { int i = 42; std::cout << "max(7,i): " << ::max(7,i) << std::endl; double f1 = 3.4; double f2 = -6.7; std::cout << "max(f1,f2): " << ::max...

What technique would you recomend when reviewing C++ for an interview?

I've got about 2/3 years C++ experience but I've spent most of my career doing Java. I'm about to go for an interview for a C++ programming role and I've been thinking about the best way to brush up my C++ to make sure I don't get caught out by any awkward questions. What would you recommend? ...

Using a vector data structure - design and syntax questions.

Dear all, I have some basic C++ design/syntax questions and would appreciate your reply. I have N number of regions Each region needs to store information about an object "element" i.e. I want to achieve something like this: region[i].elements = list of all the elements for region i. Question 1: Does the following syntax (...

[C++] Problem with SQLBindParameter on IN/OUT parameter

I have the following parameter being bound for calling a SQL procedure: TCHAR str[41]; SQLINTEGER cb; SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT_OUTPUT, SQL_C_TCHAR, SQL_C_TCHAR, 40, 0, str, 0, &cb); When I loop through str after calling the query I can see the result is there, but it's not quite right: std::stringstream ss; ss<<"{";...