kriscross07 / atom-gpp-compiler

An atom package that allows you to compile and run C++ and C within the editor.
https://atom.io/packages/gpp-compiler
80 stars 228 forks source link

Uncaught Callback must be a function #317

Open Tejasvigupta opened 4 years ago

Tejasvigupta commented 4 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.45.0 x64 Electron: 4.2.7 OS: Microsoft Windows 10 Home Single Language Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:129

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1137:14)
    at ChildProcess.child.on (/packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)

Commands

  2x -2:30.4.0 core:move-right (input.hidden-input)
     -2:24.2.0 intentions:highlight (input.hidden-input)
     -2:23.9.0 core:save (input.hidden-input)
  2x -2:10.6.0 core:backspace (input.hidden-input)
  6x -2:02.0 core:move-up (input.hidden-input)
  3x -2:00.1.0 core:move-left (input.hidden-input)
     -1:59.4.0 core:move-down (input.hidden-input)
     -1:58.6.0 editor:newline (input.hidden-input)
     -1:57.3.0 intentions:highlight (input.hidden-input)
     -1:56.9.0 core:save (input.hidden-input)
     -1:47.5.0 core:backspace (input.hidden-input)
     -1:45.8.0 intentions:highlight (input.hidden-input)
     -1:45.7.0 core:save (input.hidden-input)
     -1:39.9.0 gpp-compiler:compile (input.hidden-input)
  2x -1:32.9.0 core:backspace (input.hidden-input)
 19x -1:31.4.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

atom-file-icons 0.7.1 
atom-html-preview 0.2.6 
autocomplete-csjs 0.0.1 
autocomplete-python 1.16.0 
busy-signal 2.0.1 
class-complete 6.2.2 
css-helper-snippets 0.3.0 
css-specificity 0.2.2 
css-spy 0.6.0 
es6-javascript 1.0.0 
gpp-compiler 3.0.7 
highlight-selected 0.17.0 
html-tag-auto-complete 0.1.1 
intentions 1.1.5 
linter 2.3.1 
linter-gcc 0.9.0 
linter-gcc2 0.8.8 
linter-ui-default 1.8.1 
minimap 4.29.9 
minimap-highlight-selected 4.6.1 
node-debugger 1.10.1 
nodemon-generator 1.0.2 
platformio-ide-terminal 2.10.0 
script 3.25.0 
server-script 0.1.3 
terminal-plus 0.14.5 
turbo-javascript 1.4.0 
vk-terminal 3.0.1 
Spodeian commented 4 years ago

I've had this issue a few times, and there was something wrong with my g++ installation, I suggest you try compiling manually and see what happens.

dpsingh11 commented 4 years ago

that must be because of wrong code which you are trying to compile .do check your code as well before compiling

Tejasvigupta commented 4 years ago

include <bits/stdc++.h>

using namespace std; int main(){ int n,a; cin>>n; vector v; for (int i=0; i<n;i++){ cin>>a; v.push_back(a); } for (int i=0 ;i<n ;i++){ cout<<v[i]; } } this is a simple code and it was working fine on online compiler

Tejasvigupta commented 4 years ago

I've had this issue a few times, and there was something wrong with my g++ installation, I suggest you try compiling manually and see what happens.

Hi ,I tried compiling it on an online compiler and it worked fine there.

Tejasvigupta commented 4 years ago

I've had this issue a few times, and there was something wrong with my g++ installation, I suggest you try compiling manually and see what happens.

Are you familiar with some good packages for c++ ? Please suggest some because I have been running into one or other error.

Spodeian commented 4 years ago

include <bits/stdc++.h>

using namespace std; int main(){ int n,a; cin>>n; vector v; for (int i=0; i<n;i++){ cin>>a; v.push_back(a); } for (int i=0 ;i<n ;i++){ cout<<v[i]; } } this is a simple code and it was working fine on online compiler

There are errors in here (and the formatting is bad).

#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, a;
    vector<int> v;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a;
        v.push_back(a);
    }

    for (int i = 0; i < n; i++) {
        cout << v[i];
    }

    return 0;
}
Spodeian commented 4 years ago

try that

Spodeian commented 4 years ago

Also when I was having that error it was because of my float libraries being outdated in my g++ installation.

Tejasvigupta commented 4 years ago

Also when I was having that error it was because of my float libraries being outdated in my g++ installation.

include

using namespace std; int main(){ int a=5; auto b=a; cout<<b; } I am not able to compile even this code. Should I reinstall atom or what? p.s I am new to c++.

Double-Wen commented 4 years ago

The same problem me too

Spodeian commented 4 years ago

Also when I was having that error it was because of my float libraries being outdated in my g++ installation.

include

using namespace std; int main(){ int a=5; auto b=a; cout<<b; } I am not able to compile even this code. Should I reinstall atom or what? p.s I am new to c++.

#include <iostream>
using namespace std;
int main(){
int a=5;
auto b=a;
cout<<b;
}

include needs to actually have something to include, it can't be left empty, on top of that, cout doesn't work without iostream.

If you can't compile with this plugin on Atom, try to do it just using MSYS and g++.

The smallest code that would compile (that I can think of and has at least 1 non-return statement) is:

int main() {
  a = 0;
  return a;
}

However, my windows defender thought it was a virus. You could also do:

#define A 0
int main() {
  return A;
}
Innovation1999 commented 4 years ago

Today, I found a way to fix that #319

AleML24 commented 4 years ago

Can someone explain to me why when I compile a code I get this error: The error was thrown from the gpp-compiler package. What does that mean ? What I do?