Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
311 votes
4 answers
168k views

What are the differences between .so and .dylib on macOS?

.dylib is the dynamic library extension on macOS, but it's never been clear to me when I can't / shouldn't use a traditional unix .so shared object. Some of the questions I have: At a conceptual ...
Trent Davies's user avatar
  • 3,469
238 votes
16 answers
143k views

Finding current executable's path without /proc/self/exe

It seems to me that Linux has it easy with /proc/self/exe. But I'd like to know if there is a convenient way to find the current application's directory in C/C++ with cross-platform interfaces. I've ...
Uros Dimitrijevic's user avatar
217 votes
11 answers
272k views

How do you install Boost on MacOS?

How do you install Boost on MacOS? Right now I can't find bjam for the Mac.
Robert Gould's user avatar
  • 69.5k
178 votes
19 answers
647k views

How can I compile and run C/C++ code in a Unix console or Mac terminal?

How can I compile/run C or C++ code in a Unix console or a Mac terminal?
P-A's user avatar
  • 11.1k
136 votes
11 answers
78k views

"please check gdb is codesigned - see taskgated(8)" - How to get gdb installed with homebrew code signed?

I'm under osx 10.8.4 and have installed gdb 7.5.1 with homebrew (motivation get a new gdb with new features such as --with-python etc... ) Long story short when I run debug within a c++ Eclipse ...
pellekrogholt's user avatar
127 votes
8 answers
195k views

Compiling simple Hello World program on OS X via command line

I've got a simple hello world example that I'm trying to compile on OS X, named hw.cpp: #include <iostream> #include <string> using namespace std; int main() { cout << "Hello ...
erikvold's user avatar
  • 16.3k
127 votes
9 answers
255k views

C++ IDE for Macs [closed]

I teach a C++ course using Visual Studio. One of my students has a Mac and was looking for an IDE to use on his machine. What would be good to recommend?
JohnMcG's user avatar
  • 8,779
124 votes
8 answers
62k views

Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild

I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the ...
123's user avatar
  • 8,871
101 votes
3 answers
155k views

How to use Libraries

For some reason I'm never able to use external libraries in any language. I'm looking for instructions/explanations of how to use external libraries, as well as how they work. When I search online, I ...
sinθ's user avatar
  • 11.3k
87 votes
10 answers
100k views

How to Compile for OS X in Linux or Windows?

I would like to port my C/C++ apps to OS X. I don't have a Mac, but I have Linux and Windows. Is there any tool for this?
Unknown's user avatar
  • 46.5k
77 votes
2 answers
113k views

How to compile C++ with C++11 support in Mac Terminal

I wanted to compile C++11 source code within Mac Terminal but failed. I tried g++ -std=c++11, g++ -std=c++0x, g++ -std=gnu++11 and g++ -std=gnu++0x but nothing worked. Terminal always read ...
4ae1e1's user avatar
  • 7,494
67 votes
5 answers
16k views

Missing C++ header <__debug> after updating OSX Command Line Tools 6.3

After updating to Command Line Tools 6.3 from the App Store, programs including <vector> or <iterator> which internally include <__debug> will cause file not found error as follows. The ...
Farley's user avatar
  • 1,190
66 votes
9 answers
132k views

Update GCC on OSX

So I am a new programmer and I just installed XCode on my Macbook to get the GCC. I think Xcode is the only way for getting GCC on OSX. Now when I run my Hello World application, in C++, g++ comes up ...
Karan Bhamra's user avatar
65 votes
7 answers
43k views

Where are clang-format and clang-format.py in Mac OS X with Xcode Command Line Tools installed?

I am having a hard time finding clang-format and clang-format.py on my Mac OS 10.8.5 with Xcode 5 and its Command Line Tools. I tried find / -name "clang-format.py" without luck. Are they already here ...
Ahmed Fasih's user avatar
  • 6,730
63 votes
6 answers
43k views

Which macro to wrap Mac OS X specific code in C/C++

While reading various C and C++ sources, I have encountered two macros __APPLE__ and __OSX__. I found plenty of use of __OSX__ in various codes, especially those originating from *BSD systems. ...
mloskot's user avatar
  • 38.1k
55 votes
16 answers
33k views

Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespace

After upgrading to Catalina from Mojave, Setuping: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk in the env. I'm unable to compile a program that ...
roman Sztergbaum's user avatar
54 votes
14 answers
58k views

How to Detect the Number of Physical Processors / Cores on Windows, Mac and Linux

I have a multi threaded c++ application that runs on Windows, Mac and a few Linux flavors. To make a long story short: In order for it to run at maximum efficiency, I have to be able to instantiate ...
HTASSCPP's user avatar
  • 619
52 votes
2 answers
46k views

How to dump the symbols in a .a file

Can you please tell me how can I dump all the symbols in a .a file on MacOS X? I am getting a linking error while compiling my c++ problem on MacOS X. I would like to find out if the sybmols exists ...
n179911's user avatar
  • 20.1k
52 votes
8 answers
53k views

macOS Clang C++17 filesystem header not found

I need to write a program using the (experimental) C++17 filesystem library but clang on my Mac (macOS 10.12.03) doesn't seem to have the filesystem header included. Since I'm required to use the C++...
snoato's user avatar
  • 644
51 votes
9 answers
60k views

Error when compiling some simple c++ code

I try to compile this cpp code on osx lion but I get an error. #include <iostream> using namespace std; int main (int argc, char *argv[]) { for(int i = 0; i < 10; i++) { ...
Jean-Philippe Leclerc's user avatar
50 votes
10 answers
45k views

How to get a "codesigned" gdb on OSX?

Because I need a Python-enabled gdb, I installed another version via brew tap homebrew/dupes brew install gdb I want to use this gdb with Eclipse CDT, where I entered the path to the binary in the ...
clstaudt's user avatar
  • 22.2k
48 votes
1 answer
66k views

Installing C++ Libraries on OS X

I am trying to get my head around some basic concepts, but I can't seem to figure them out. I am really confused over what it means to install (I think they are called libraries) for C++. I am ...
Giesbrecht's user avatar
47 votes
4 answers
63k views

c++ #ifdef Mac OS X question

I am fairly new to C++. I am currently working on a group project and we want to make our classes compatible with both the lab computers (Windows) and my computer (Mac OS X). Here is what we have ...
Kirsty's user avatar
  • 471
46 votes
3 answers
49k views

How to use the gcc installed in macports?

I installed gcc 4.6. from macports (for support of C++0x). But when I check the 'gcc --version` it is showing older version. How to use the newer gcc installed by macports?
Nemo's user avatar
  • 25k
46 votes
3 answers
74k views

Undefined symbols for architecture x86_64: Which architecture should I use?

I'm trying to do some really simple stuff in C++, but I can't find any information on how to tackle this. Even the book I have just says "Just compile and run the program". test.cpp #include <...
oskob's user avatar
  • 1,376
46 votes
2 answers
54k views

How to link against boost.system with cmake

I use a cmake generated makefile to compile a c++ file that depends on the boost filesystem library. During the linking process I get the following error: Undefined symbols: "boost::system::...
Janusz's user avatar
  • 189k
46 votes
23 answers
121k views

How can I include <bits/stdc++> in Xcode

I have tried to include the header file bits/stdc++ in my C++ code, but it seems the compiler doesn't support it. Is there any way to make it work? I use OS X Yosemite 10.10.2 and Xcode 6.1.1.
Omar's user avatar
  • 831
46 votes
4 answers
72k views

OSX - replace gcc version 4.2.1 with 4.9 installed via Homebrew

This has been plaguing me for awhile now. I am trying to compile a huge C++ file (I know it works as I it works fine on my Arch Linux computer at work). When I checked my GCC version on my mac It ...
Dacotah's user avatar
  • 591
44 votes
4 answers
58k views

Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X

I have created a C++ application using Xcode on my Mac using the Clang compiler. I want to compile my source files to create an executable that can be ran on a windows machine however I cant get ...
gavlaaaaaaaa's user avatar
43 votes
8 answers
23k views

Broken c++ std libraries on macOS High Sierra 10.13

I recently bought a new MacBook on which I transferred my old session. Since then, and after i upgraded to 10.13, i can't get clang to compile anything including only iostream. Given this program : ...
Marcadia's user avatar
  • 538
40 votes
3 answers
37k views

Find out if/which BLAS library is used by Numpy

I use numpy and scipy in different environments (MacOS, Ubuntu, RedHat). Usually I install numpy by using the package manager that is available (e.g., mac ports, apt, yum). However, if you don't ...
Apoptose's user avatar
  • 579
40 votes
6 answers
74k views

How to enable C++17 on Mac?

I am able to update gcc on Linux to get -std=c++17, but cannot do the same on Mac. Is there a version of Clang I can update to or some other alternative to get C++ 17 on my Mac? Please help. Thanks.
TheBigMalaka's user avatar
39 votes
2 answers
35k views

Develop using OpenGL 4.x on OSX Big Sur

According to Apple, OpenGL is no longer supported. However, it appears v4.1 of OpenGL was supported on many devices as of July 28, 2020. I have a 2020 Macbook Pro 16" model, which does not show ...
ryno's user avatar
  • 906
37 votes
4 answers
83k views

How to use dylib in Mac OS X (C++)

I made an application (an executable) calling some dylib successfully. However, the dylib files and the executable are in different directory. I added the directory contains dylib files to the $PATH ...
Alfred Zhong's user avatar
34 votes
5 answers
25k views

Relative Paths Not Working in Xcode C++

There are numerous post over the net that detail how relative paths don't work in Xcode. I do have an Xcode template that I downloaded where the relative paths DO work, however I have not been able to ...
Brock Woolf's user avatar
  • 47.1k
34 votes
3 answers
36k views

Object file was built for newer OSX version than being linked

I'm getting this error for C++ library I'm using. It uses GNU Automake for building. Which flag(s) I should supply for the make command to lower the target build platform to avoid seeing this warning ...
peetonn's user avatar
  • 2,982
33 votes
3 answers
63k views

Colored output in C++

Is there a way to print colored output using iostream and Xcode? I'd like to be able to, for example, print Hello World! with Hello red, World blue and ! yellow. How can I do that?
Shoe's user avatar
  • 75.8k
32 votes
9 answers
33k views

Unique hardware ID in Mac OS X

Mac OS X development is a fairly new animal for me, and I'm in the process of porting over some software. For software licensing and registration I need to be able to generate some kind of hardware ID....
Gerald's user avatar
  • 23.3k
32 votes
8 answers
103k views

Qt FullScreen on Startup

I want to start an application on fullscreen (MacOS 10.8.x, Qt 5.1.1, C++) depending on the settings: main.cpp #include "MainWindow.h" #include <QApplication> int main(int argc, char *...
Thomas Ayoub's user avatar
  • 29.3k
32 votes
2 answers
41k views

Installing Eigen on Mac OS X for XCode

A while back it was a nightmare for me trying to get Eigen up and running on my mac for XCode, but a friend managed to figure it out and shared the instructions with me. I don't want anyone to go ...
Maria-Andersado's user avatar
32 votes
1 answer
2k views

What is going on: C++ std::move on std::shared_ptr increases use_count?

I was always assuming that std::move() on a std::shared_ptr steals the pointer and sets the pointer of the original to nullptr-thus not increasing the reference count. That does not seem to be true in ...
Frank-Rene Schäfer's user avatar
31 votes
1 answer
100k views

How do I run a C++ program in Xcode 4?

I want to write a C++ program in Xcode on my Mac. I wrote this basic one to test it. When I build, I get a "Build Successful" message. However, I cannot run it! If I hit Command+R nothing happens. ...
user avatar
31 votes
6 answers
202k views

How do I install g++ on MacOS X?

I want to compile C++ code on MacOS X, using the g++ compiler. How do I install it?
Josh Glover's user avatar
  • 25.9k
31 votes
3 answers
42k views

Rewinding std::cout to go back to the beginning of a line

I'm writing a command-line tool for Mac OS X that processes a bunch of files. I would like to show the user the current file being processed, but do not want a bazillion files polluting the terminal ...
fbrereto's user avatar
  • 35.8k
30 votes
2 answers
45k views

How to install gtk on OSX for use with g++/gcc compiler

I already asked this question at apple.stackexchange.com, but I was told it was the wrong place for this question - so I will ask it here, as I was suggested to do. At my university we got the task ...
tmuecksch's user avatar
  • 6,552
29 votes
1 answer
20k views

How do I turn a "fat" library into a "non-fat" library?

I'm trying to remove a duplicate object from a library with armv6 and armv7 architectures, i.e., $ lipo -info libx.a Architectures in the fat file: libx.a are: armv6 armv7 As expected, "ar d" ...
tofutim's user avatar
  • 23.1k
29 votes
2 answers
35k views

dSYM Directories While Compiling C++ Code in MacOS

Why compiling C++ in Mac always create *.dSYM directories? Is there a way to disable that?
neversaint's user avatar
  • 63.1k
29 votes
1 answer
696 views

`is_always_lock_free` gives `true` but `is_lock_free()` gives `false` on macOS, why?

I'm experimenting with C++ atomic's std::atomic<T>::is_always_lock_free and std::atomic<T>::is_lock_free. I wrote a simple struct A and want to know if the atomic version of A is lock-free:...
Shuai's user avatar
  • 1,125
28 votes
2 answers
32k views

linking with clang++ on OS X generates lots of symbol not found errors

I'm trying to compile some C++ code (including C++11 features) on OS X 10.8 using the clang++ compiler. I have a makefile that generates the object files OK, then on the command: clang++ -o Analysis....
Alex Z's user avatar
  • 1,489
28 votes
7 answers
29k views

gprof reports no time accumulated

I'm trying to profile a C++ application with gprof on a machine running OSX 10.5.7. I compile with g++ in the usual way, but using -pg flags, run the application and try to view the call graph with ...
Daniel's user avatar
  • 24.3k

1
2 3 4 5
120