Giter VIP home page Giter VIP logo

Comments (15)

sandip2224 avatar sandip2224 commented on May 30, 2024 1

O great finally it works. Seems like I had McAfee working all the while.

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

Tell me somehting :

  • Open terminal in the vs code

  • Go to the cpp file directory

  cd Programs
  • Use manual command

    • Build
     g++ test.cpp -o test.out 
    
    • Run
     ./test.out
    

is this working fine in your machine ?
Is there any anivirus running ? like avast or something which can prevent running programmes ?
You can also delete the test.cpp file and create a new one and try again !

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

Yeah I tried the manual build commands but it asks for user input via the terminal itself instead of reading from the input.txt file. Moreover output it showing up inside the terminal.

Here's the commands I used inside Programs folder:

  1. g++ test.cpp -o test.out
  2. ./test.out

I tried the above commands after disabling Windows defender (I don't have any additional antivirus installed) and got the same result.

1

P.S.: Ctrl+Shift+B is producing the same error.

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

@sandip2224 i think it's the test.exe file which is making the error ! Delete this and try ctrl+shift+b

Is ctrl+shift+b making the exe file ?

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

Tried reinstalling MinGW and re-checked environment variable path.

So weird but now it WORKS just fine with Ctrl+Shift+b using test cases from input.txt and prints result to output.txt. Only had to add these lines inside my main() function.

freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);

Could you please explain how/why this works?

P.S.: I used the following manual build commands:

  1. g++ test.cpp -o test.out
  2. ./test.out

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

MinGW was working fine in your machine that's why i asked to use manual commands.
Isn't it working without "freopen" in your main function ?
And i have also asked a question that "was my script creating the exe file ? " @sandip2224

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

It's not working without the "freopen" inside main, and no, the Ctrl + Shift + b isn't creating the .exe file

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

If it's not creating the exe file then just delete the exe file and try the shortcut (Ctrl + Shift + b) ?

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

I just did. It's stuck at ./test.out without the 'freopen'. And works just fine with that.

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

using Ctrl + Shift + b in vscode got stuck in ./test.out? I am not saying to use manual command from the terminal .

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

Okay give me a second. Here's what it's showing inside the bash terminal now. But I don't see any output in output.txt.
11

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

give me the whole screenshot like this

from vs-code-config.

sandip2224 avatar sandip2224 commented on May 30, 2024

Before running Ctrl+Shift+b:

1

After running Ctrl+Shift+b:

2

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

which task.json file you are using?
The fisrt one when you got the launch faild error and now you are giving me the pictures are not using same script i guess!
And 2nd question is : "where is the exe coming from ?
p1

image

from vs-code-config.

jspw avatar jspw commented on May 30, 2024

Yup that's why I told you to check your free antivirus :3
btw I'm closing this issue .

from vs-code-config.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.