user1829
user1829

Reputation: 33

VS Code: command-line error:missing source file name

This is picture of my screen: this is a picture of my screen.This error shows up when I enter #include <stdio.h>to begin my program. I'm not sure how to fix this. Every file in Visual Studio Code is now having this issue.

I use gcc. gcc -o outputname filename.c and using C/C++ IntelliSense, debugging, and code browsing extension by Microsoft.

Upvotes: 3

Views: 8088

Answers (4)

Ben Stephenson
Ben Stephenson

Reputation: 11

I had the same issue. I just uninstalled and reinstalled the c/c++ extension and it was back to normal

Upvotes: 1

thinkOfaNumber
thinkOfaNumber

Reputation: 2883

Various things may contribute to this error:

  • unclosed quotes in preprocessor definitions, macros or even c_cpp_properties.json
  • file encoding
  • the VS Code cpp extension

It has come and gone in my c/c++ development, and I don't know if anything specific I've done fixes it or if just restarting VS Code is the solution.

Most recently, I

  1. changed the encoding of all files from UTF-8 to ANSI (in case there were any hidden unicode characters in the file, which happens with copy & paste sometimes)
  2. restarted VS Code
  3. it then complained that the c/c++ extension wasn't installed (it was?) and so I installed it again, and the error is gone.

Upvotes: 1

Viktor Plaček
Viktor Plaček

Reputation: 59

I ran into the same problem this morning. IntelliSense was at fault. Only solution I quickly had found for me was to hard-delete C++ IntelliSense extension. Plain uninstall did not help.

You can remove IntelliSense Extension this way:

  • close all instances of Visual Studio Code,
  • navigate to folder %USERPROFILE%\.vscode\extensions
  • delete a folder/folders (incl. subfolders) ms-vscode.cpptools*
  • start Visual Studio Code again and install fresh IntelliSense extension.

NOTE: you may lose your IntelliSense custom settings!

Upvotes: 0

Vipul Sinha
Vipul Sinha

Reputation: 840

As you didn't explain the question well. I think that there is a macro in the build options that is not defined so it gets inserted into the build command as a blank string. Does your project use some macros in the build options maybe something for 55x CSL directory?

If so make sure to define these macros on the macro tab of the build options dialog.

Upvotes: 1

Related Questions