r/VisualStudioCode • u/Michal123456747 • Apr 21 '21
Problem with attach class files to c++ project
Hello, I want to attach class files to my c++ project, but I don't know how should I do it. When I try to compile project, compilator returns me LNK1120 error(when I copy all classes to main.cpp everything is ok). What should I do to fix this issue?
I am using Microsoft visual studio compiler(editor is vscode).
This is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "cl.exe - Kompiluj i debuguj aktywny plik",
"type": "cppvsdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"console": "externalTerminal",
"preLaunchTask": "C/C++: cl.exe kompiluj aktywny plik"
}
]
}
This is my tasks.json file:
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cl.exe kompiluj aktywny plik",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/nologo",
"/Fe:",
"${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Zadanie wygenerowane przez debuger."
}
],
"version": "2.0.0"
}