Wie erstelle ich eine einfache C ++ - Anwendung mit MacOS CoreFoundation? [Duplikat]
Posted: 11 May 2025, 22:46
Ich versuche, eine einfache C ++ - Anwendung zu erstellen, die von Mac OS CoreFoundation abhängig ist. Dies handelt
Das Flag -framework ist nicht g ++ oder gcc . Es ist Linker () Option.
[/list]
Code: Select all
#include
#include
#include
#include
// #include
// #include
using namespace std;
int main()
{
vector msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
for (const string& word : msg) {
cout
Ich habe versucht, die Antwort zu finden, aber ohne Erfolg. Zum Beispiel sieht diese Frage ähnlich aus wie meine, aber ich konnte sogar nicht in der Lage sind, das FLAY zu verwenden, da es nicht vorhanden ist. class = "Lang-CPP PrintPrint-Override">#include
< /code>
[list]
[*] und der folgende Befehl bauen: < /li>
< /ol>
g++ -framework CoreFoundation -g /Users/kostyastern/projects/TestGCCProject/src/helloworld.cpp -o /Users/kostyastern/projects/TestGCCProject/bin/helloworld -v
Code: Select all
ld
[/list]
Code: Select all
> man ld
NAME
ld – linker
SYNOPSIS
ld files... [options] [-o outputfile]
DESCRIPTION
The ld command combines several object files and libraries, resolves references, and produces an output file. ld can produce a final linked image (executable, dylib, or bundle), or with the -r option, produce another object file. If the -o option is not used, the output file produced is named "a.out".
.....
-framework name[,suffix]
This option tells the linker to search for `name.framework/name' the framework search path. If the optional suffix is specified the framework is first searched for the name with the suffix and then without (e.g. look for `name.framework/name_suffix' first, if not there try `name.framework/name').