I am having an issue with compiling my Mystring
(very simple and easy beginner C++ code) and can't resolve this error:
Error:"ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
Warning: "(base) Fans-MBP:Section14 fanyang$ cd "/Users/fanyang/Documents/Tests/Tests/FirstWorkspace/Section14/" && g++ main.cpp -o main && "/Users/fanyang/Documents/Tests/Tests/FirstWorkspace/Section14/"main
In file included from main.cpp:2:
./Mystring.h:30:23: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
Mystring(Mystring &&source);
^
./Mystring.h:34:34: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
Mystring &operator=(Mystring &&rhs);
^
./Mystring.h:37:35: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
Mystring &operator+=(Mystring &&rhs);"
I am using VSCode (was using Codelite and switched to VSCode just yesterday and the code that ran fine now doesn't run).
Here are my task and launch files:
tasks.json
:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang++ build active file",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${file}",
"-o",
"${fileDirname}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
launch.json
:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "clang++ - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "clang++ build active file"
}
]
}
Aucun commentaire:
Enregistrer un commentaire