Tag Archives: vscode

VSCode Error: collect2.exe:error:1d returned 1 exit status [How to Solve]

Recently, I learned the C + + program video of dark horse. When I realized the employee management system based on polymorphism, I knocked the same code as the video, but I couldn’t compile it successfully by using vscode, and the following errors occurred:

[Employee_Management_System.cpp 2021-10-22 13:58:17.099]
,,C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x1b): undefined reference to `WorkerManager::WorkerManager()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x27): undefined reference to `WorkerManager::Show_Menu()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x44): undefined reference to `WorkerManager::~WorkerManager()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x57): undefined reference to `WorkerManager::~WorkerManager()'
collect2.exe: error: ld returned 1 exit status

After querying many blogs, it is found that the causes and solutions of errors such as collect.exe: error: 1D returned 1 exit status are as follows
1. The last compiled program is not closed, that is, the black box still exists. Find it and close or restart the IDE
2. The program has no main function or the main function is misspelled
3. Running in vscode will not help you save the code. You need to save the code before running
4. The file name and file path may cause errors in some compilers
5. There is an undefined reference. This is the case for this error. When instantiating the classes of other files in the main function, you need to define the .H file and .Cpp file of other classes to solve the problem.

#include<iostream>
#include"workerManager.h"
#include"workerManager.cpp"

[Solved] VS Code Error: Vetur can‘t find ‘tsconfig.json‘ or ‘jsconfig.json‘

1. Cause

A new configuration file of vetur.config.js is added in vetur 0.31.0.
after this version, priority will be given to finding whether the project is equipped with tsconfig.json (TS project) or jsconfig.json (JS project).
if these two files are not found, go to vetur.config.js. If they are not found, this prompt will be thrown.

2. Explain

The JavaScript support of vscode can run in two different modes:
file range (without jsconfig.JSON)
in this mode, JavaScript files opened in vscode are regarded as independent units
as long as the file A.js does not explicitly reference the file b.ts (using// reference instructions or commonjs modules), there is no common project context between the two files.

3. Explicit project

(use jsconfig.JSON)

The JavaScript project is defined through the jsconfig.JSON file. The existence of such a file in the directory indicates that the directory is the root directory of the JavaScript project
the file itself can optionally list files belonging to the project, files to be excluded from the project, and compiler options (see below)
the JavaScript experience improves when you have a jsconfig.json file in your workspace that defines the project context
therefore, when you open a JavaScript file in a new workspace, we provide a prompt to create a jsconfig.json file.

4. Solution (1 out of 3)

4.1. Configure the vehicle plug-in and ignore the prompt </ H6>
 "vetur.ignoreProjectWarning": true,

4.2. Create jsconfig.json file in the project root directory </ H6>

Add code:

{
    "include": [
        "./src/*"
    ]
}
4.3. Create the vetur.config.js file in the project root directory </ H6>

Add code:

module.exports = {
    // vetur configuration, which will override the settings in vscode.  default: `{}`
    settings: {
        "vetur.useWorkspaceDependencies": true,
        "vetur.experimental.templateInterpolationService": true
    },
    // Normal projects use the default configuration default: `[{ root: './' }]`
}

[salesforce] prompt error deploying or retrieving source when vscode pulls the code

Prompt error deploying or retrieving source when vscode pulls the code

When sfdx: retrieve this source from org is executed, the following information is prompted:

Error deploying or retrieving source: The file or directory that you tried to deploy or retrieve isn’t in a package directory that’s specified in your sfdx-project.json file. Add this location to your “packageDirectories” value

resolvent

Open the sfdx project. JSON configuration file (in the root directory or Ctrl + P search)

Add the following elements to the "packagedirectories" attribute array of the configuration file:

    {
      "path": "XXX",
      "default": false
    }

Note that path is the directory (root directory) where the file you want to pull is located. For example, the root directory of your file is called “functional”, and XXX here will fill in functional .

Save after adding, and then pull the file again.

C++ Primer Program in VsCode error: no match for call to ‘(std::__cxx11::string…)

In the original file, total. Isbn() = = trans. Isbn() will report an error in vscode, “unable to match the call error”
compile. CPP: 12:37: error: no match for call to ‘(STD:: _cxx11:: String
{aka STD:: _cxx11:: basic_string}) ()’
if (total. Isbn() = = trans. Isbn())
solution: remove the brackets after. Isbn() and change the primitive sentence to

if (total.isbn==trans.isbn)

The reason is that ISBN should be a parameter value rather than a method, or it may be caused by my environment. It is for reference only.

#include <iostream>

#include"Sales_item.h"
int main(){
   Sales_item total;
   if (std::cin>>total)
   {Sales_item trans;
   while (std::cin>>trans)
   {
       if (total.isbn()==trans.isbn())
            total+=trans;
        else
        {
       std::cout<<total<<std::endl;
       total=trans;
        }
   
     
   }
   
    std::cout<<total<<std::endl;
   }
   else{
       std::cerr<<"NO Data?!"<<std::endl;
       return -1;
   }
   return 0;
    
}

[Solved] Vscode Connect SSH Error: Error Running the contributed command ‘_workbench.downloadResource

Question

An error occurred while connecting with vscode error: running the contributed command: '"_ workbench.downloadResource

Solution

Using common online solutions does not solve the problem. The last reason is that the remote network has not been updated for a long time, and the local network has been updated automatically. Therefore, the local vscode cannot be connected to the remote because the remote has not been updated.

I only need to connect the local computer and the remote computer to the same network (must be able to access the Internet), and then use the local vscode to connect to the remote. The remote will automatically update the connected service.

This dependency was not found:* vue-editor-bridge

Error reporting result:

When the project is running, a compilation error occurs suddenly and the dependency cannot be found. Follow the prompt to execute NPM install — save Vue editor bridge, or an error is reported

This dependency was not found:

* vue-editor-bridge in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/Test.vue?vue&type=script&lang=js&

To install it, you can run: npm install --save vue-editor-bridge
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'

Cause finding:

After finding similar error reports, it is found that vscode automatically adds a line of import, as if it entered func when entering function, and vscode imported func as a component by default (you don’t have to be so smart?)

import func from 'vue-temp/vue-editor-bridge'

Solution:

Just delete this line of code

Vscode automatically formats the code when an error is reported

Use default

Prettier vscode save code auto format plug-in used by vscode
select formatonsave in vscode settings or modify it in setting.json

"editor.formatOnSave": true,

Use eslint for automatic formatting

Sometimes your front-end project uses eslint, which has automatic formatting configuration. We want to use the project’s own eslint configuration. We can use the format of eslint when saving automatically.

Let’s install the eslint plug-in first

Then set it in vscode

"editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
 }

Add this configuration. In this way, the eslint configuration of the project itself will be used when saving.

error Expected indentation of 2 spaces but found 8

 

Originally, two spaces were needed, but there were actually eight. The appearance of eight spaces is generally caused by the tab key

Comment out this line:         ‘@ vue/standard’

It is important to note that after modifying the. Eslintrc.js file, it can take effect only after restarting
according to the startup command of your project: NPM run serve

[Vue error] the solution to the template root requires exactly one element error reporting

Error content
Vue error: the template root requires exactly one element

See the following figure for details:

error information in vscode

error information in node

Error reason
Vue only allows one root node in the template.

Solution

Add a <div> tag to <template>, after that all the components will be added to <div> to solve the problem.