Sublime Forum

C++ program not executing

#1

Sometimes my cpp code is getting executed without any error but sometimes it is producing error and it is very annoying coz I have tried everything followed every step correctly but still it isn’t getting solved. This is the error I am getting:-

C:/Program Files (x86)/mingw-w64/bin/…/lib/gcc/i686-w64-mingw32/8.1.0/…/…/…/…/i686-w64-mingw32/bin/ld.exe:C:\Users\LENOVO\Desktop\cpp\input.txt: file format not recognized; treating as linker script

0 Likes

#2

Looks like you’re trying to compile and link a text file instead of a source code file. What’s your sublime-build file look like?

0 Likes

#3

sublime build as in “sublime build system” ? And below is my sublime setup

0 Likes

#4

Indeed; in order to diagnose what’s going wrong we need to see what steps it’s actually trying to take. One way to show that is to show the contents of the sublime-build file that you created (if you’re not using the one that’s built in), which tells Sublime what command to run. Another is to show the full error diagnostic from the output panel, which would include not just the error you posted above but also the command it tried to execute.

0 Likes

#5

yeah sure, this is the build which I used:

    {
 "shell_cmd": "g++ -std=c++14 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
     "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
     "working_dir": "${file_path}",
     "selector": "source.c, source.c++",
     "variants":
     [
     	
       {
         "name": "Run",
        "shell_cmd": "g++ -std=c++14 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
       }
     ]
    }
0 Likes

#6

What’s the full error diagnostic information from the build panel when the failure in your original post happens?

0 Likes

#7

Right now the only error which I am getting is the below one basically these two one which I mentioned earlier and the below are the most frequent that I get and this hinders my progress very badly.

0 Likes

#8

Anyone??

0 Likes

#9

Permission denied usually means it can’t write to the exe file because it is in use - ie. running, no? Maybe need to cancel the previous bu, ld first?

0 Likes

#10

do u have c++ sdk installed

0 Likes

#11

Sublime captures the content of stdout for display in the output panel, so I would guess that the freopen() call that’s replacing stdout is causing issues with Sublime’s ability to display proper diagnostic output, because any failing build always causes Sublime to display more diagnostic information than you’re seeing.

That makes it very difficult to see why it’s failing because it’s unclear what it was actually trying to do.

0 Likes