I've been coding on C++/Linux for 10+ years.
I am switching to do Mac development.
My development involves GUI components.
Is my only choice to learn Cocoa/Objective-C, or is there a way to wrap Cocoa and use it from C++ land?
Thanks!
...
I’m writing file browsing software and I want it to work correctly with all portable devices, such as cameras, smart phones and so on. My program shows thumbnails, so I need to read the content of each file.
Now I’m facing some problems:
With both my photo cameras I can open only one ISteam from device. For every additional stream I g...
I have a program that brings up and tears down multiple threads throughout its life. Everything works great for awhile, but eventually, I get the following core dump stack trace.
#0 0x009887a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x007617a5 in raise () from /lib/tls/libc.so.6
#2 0x00763209 in abort () from /lib/tls/lib...
Excuse my ignorance here but I know neither C++ nor GTK+.
Which String type is used when setting Strings in GTK+ widgets?
In .NET, Strings passed to a control are obviously .NET System.String. In Cocoa, Strings passed to a control are NSString. But I understand C++ does not have a standardized String type (but indeed several, depending...
In C++ I can use typeid operator to retrieve the name of any polymorphic class:
const char* name = typeid( CMyClass ).name();
How long will the string pointed to by the returned const char* pointer available to my program?
...
Hi Guys,
I have written a wrapper on top of MSXML in c++ . The load method looks like as below.
The problem with the code is it fails to load well formed xml sometimes.
Before passing the xml as string I do a string search for xmlns and replace all occurrence of xmlns with xmlns:dns.
In the code below I remove bom character. Then i...
g++ -framework OpenGL GLFT_Font.cpp test.cpp -o test -Wall -pedantic -lglfw -lfreetype - pthread `freetype-config --cflags`
Undefined symbols:
"_GetEventKind", referenced from:
__glfwKeyEventHandler in libglfw.a(macosx_window.o)
__glfwMouseEventHandler in libglfw.a(macosx_window.o)
__glfwWindowEventHandler in libg...
I am working on a fairly significantly-sized project which spans many shared libraries. We also have significant reliance on the STL, Boost and our own template classes and functions. Many exported classes contain template members and exported functions contain template parameters.
Here is a stripped-down example of how I do library e...
I am involved in a contest, and in one event we have debugging questions. I have to design some really good debugging problems in C and C++.
How can I create some good problems on debugging? What aspects should I consider while designing the problems?
...
So I'm working with this huge repository of code and have realized that one of the structs lack an important field. I looked at the code (which uses the struct) as closely as I could and concluded that adding an extra field isn't going to break it.
Any ideas on where I could've screwed up?
Also: design advice is welcome - what's the be...
Hello,
I have started out to write a simple console Yahtzee game for practice. I just have a question regarding whether or not this function will leak memory. The roll function is called every time the dices need to be re-rolled.
What it does is to create a dynamic array. First time it is used it will store 5 random values. For the next...
Hi,
How do I 'dive' an int * which points to a dynamically allocated array of integers and represent it as a fixed int[] array? Put otherwise, if I dive an int * it shows the address and the int pointed to, but instead I would like to see the array of all of the integers.
...
Suppose I have a class
class Foo
{
public:
~Foo() { delete &_bar; }
void SetBar(const Bar& bar)
{
_bar = bar;
}
const Bar& GetBar() { return _bar; }
private:
Bar& _bar;
}
And my usage of this class is as follows (assume Bar has a working copy constructor)
Foo f;
f.SetBar(*(new Bar));
const Bar* bar =...
i want to store a string entered by the user including the space characters into the following array
char array[100];
how can i do it.
...
I am developing a portable C++ application. Development environment is Linux. I have a code that loads data from Xml file and create a object model out of it. Currently path to file is provided as /home/myuser/projectdir/xmlfilename.xml. This is problematic when I use from a different computer where the home directory name will be differ...
Sorry if this has been asked before, but I am wondering what the use of std::vector::front() is.
Is there a reason to use e.g. myvector.front() rather than myvector[0] or myvector.at(0)?
...
I'm trying to write a recursive function that does some formatting within a file I open for a class assignment. This is what I've written so far:
const char * const FILENAME = "test.rtf";
void OpenFile(const char *fileName, ifstream &inFile) {
inFile.open(FILENAME, ios_base::in);
if (!inFile.is_open()) {
cerr << "Could...
I use GetForegroundWindow to get the foreground window handle but if there is no window, then it returns the HWND to the desktop. How do I know if the HWND is the desktop?
...
Hi,
I need to prevent a class from being derived from so I thought to myself, this is something that Boost is bound to have already done. I know they have a noncopyable, they must have a nonderivable...
Imagine my surprise when I couldn't find it....
That got me thinking.. There must be a reason. Maybe it isn't possible to do using te...
I find that it is tremendously easier to use streams in c++ instead of windows functions like ReadFile, WriteFile, etc or even fprintf. When is it not good to use streams? When is it good to use streams? Is it safe to use streams? How come a lot of programmers don't use streams?
This is just something I've always wondered about and mayb...