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 #255

Open pr0me7heu2 opened 5 years ago

pr0me7heu2 commented 5 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.34.0 x64 Electron: 3.1.1 OS: linux 4.20.4-arch1-1-ARCH Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:157

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1290: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:961:16)
    at Socket.stream.socket.on (internal/child_process.js:380:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close [as _onclose] (net.js:596:12)

Commands

     -7:29.4.0 snippets:expand (input.hidden-input)
     -7:29.4.0 editor:indent (input.hidden-input)
     -7:27.4.0 autocomplete-plus:confirm (input.hidden-input)
     -7:27.4.0 snippets:expand (atom-text-editor.editor.is-focused.autocomplete-active)
     -7:23.8.0 core:undo (input.hidden-input)
  2x -7:21.3.0 editor:newline (input.hidden-input)
     -7:17.8.0 snippets:next-tab-stop (input.hidden-input)
     -7:17.8.0 snippets:expand (input.hidden-input)
     -7:17.8.0 editor:indent (input.hidden-input)
     -7:09.5.0 editor:move-to-end-of-word (input.hidden-input)
     -7:07.7.0 editor:newline (input.hidden-input)
     -7:04.9.0 core:backspace (input.hidden-input)
     -6:19.7.0 gpp-compiler:tree-compile (span.name.icon.icon-file-text)
     -6:01.0 core:move-left (input.hidden-input)
  2x -5:59.2.0 core:backspace (input.hidden-input)
     -5:54.2.0 gpp-compiler:tree-compile (li.file.entry.list-item.selected)

Non-Core Packages

autocomplete-clang 0.11.5 
autocomplete-ctags 0.4.1 
gpp-compiler 3.0.7 
linter 2.3.0 
linter-clang 4.1.2 
JestDotty commented 5 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.34.0 x64 Electron: 3.1.6 OS: "Manjaro Linux" Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:157

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1290: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:961:16)
    at Socket.stream.socket.on (internal/child_process.js:380:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close [as _onclose] (net.js:596:12)

Commands

     -6:29.7.0 application:add-project-folder (ol.tree-view-root.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -2:35.5.0 intentions:highlight (input.hidden-input)
     -2:35.2.0 settings-view:open (input.hidden-input)
     -1:31.3.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

acid-syntax 1.0.0 
atom-material-syntax 1.0.8 
atom-ternjs 0.19.1 
atom-xterm 6.5.0 
busy-signal 2.0.0 
chester-atom-syntax 0.3.2 
chrome-color-picker 0.8.0 
dun-syntax 0.4.0 
duotone-dark-sea-syntax 2.1.0 
duotone-dark-syntax 2.1.0 
emoji-code 0.8.2 
firewatch-syntax 1.1.1 
framerjs-syntax 1.4.0 
gpp-compiler 3.0.7 
intentions 1.1.5 
isotope-ui 2.8.5 
language-markdown 0.29.0 
language-pug 0.0.22 
line-count 0.5.2 
linter 2.3.0 
linter-eslint 8.5.2 
linter-ui-default 1.7.1 
monokai-seti 0.9.0 
now-syntax 0.2.4 
nucleus-dark-ui 0.12.3 
pigments 0.40.2 
rad-syntax 0.4.0 
ramda-syntax 1.0.4 
save-workspace 0.5.0 
selection-highlight 0.1.6 
seti-ui 1.11.0 
stylus-language 2.6.0 
styri-syntax 1.0.0 
sync-settings 0.8.6 
tab-control 0.6.11 
tabs-to-spaces 1.0.5 
teletype 0.13.3 
JuanPantaleonFQ commented 5 years ago

can someone explain me how to fix this error, I have try to install Gpp compiler to program C++ on Atom 5 times, every time same error, NEED HELP... I am new at atom and programing, so I need carefully instrucctions.

thank you.

karakunai commented 5 years ago

I got this issue as well right after the 1.39.0 update, could it be that the package got broken by ?

adamsoutar commented 5 years ago

For me, this happens when I compile C (gpp-compiler:compile) with mistakes in it. If the file is OK, it doesn't throw an Atom exception. If the file is missing a semi-colon or something, I see the gpp error and this Atom error.

karakunai commented 5 years ago

Well, on my side it used to be thrown no matter whats inside the file @adamsoutar , but then things are somehow has just went back to normal here.

karakunai commented 5 years ago

Seriously, I didn't do anything on my system right after the update other than restarting, but it works again today somehow. Interestingly, I can still trigger the bug on the gpp package by liveace with the same file.

karakunai commented 5 years ago

I guess I should stay with g++ filename.cpp -ofilename for now to make sure that I can deliver my codes on time. I'll try to experiment more later.

Nortgen commented 5 years ago

So i'm trying to learn C++ and i use Atom to do it. I followed this tutorial https://www.youtube.com/watch?v=ZkEVZ8LCtvg and when I tried to write a couple lines of codes to try, it doesn't work and they show me this message

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.39.1 x64 Electron: 3.1.10 OS: Unknown Windows version Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:157

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1290: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:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

Commands

  8x -7:29.1.0 intentions:highlight (input.hidden-input)
     -7:28 script:run (input.hidden-input)
     -7:14.7.0 gpp-compiler:compile (input.hidden-input)
  2x -6:57.7.0 editor:newline (input.hidden-input)
     -6:57.2.0 intentions:highlight (input.hidden-input)
     -6:56.9.0 core:paste (input.hidden-input)
 18x -6:36.6.0 intentions:highlight (input.hidden-input)
  4x -6:34 core:backspace (input.hidden-input)
     -0:07.5.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

ask-stack 2.2.0 
atom-beautify 0.33.4 
atom-python-run 0.9.7 
autocomplete-python 1.14.1 
busy-signal 2.0.1 
essence-dark-syntax 0.2.1 
file-icons 2.1.33 
gpp-compiler 3.0.7 
highlight-selected 0.16.0 
ide-python 1.4.2 
intentions 1.1.5 
linter 2.3.0 
linter-ui-default 1.7.1 
minimap 4.29.9 
minimap-lens 0.3.0 
python-debugger 0.2.0 
script 3.18.1 
AionDev commented 5 years ago

I'm getting this issue because I'm on Windows10 and i'm trying to #include <sys/socket.h> file and because windows does not have it - read here why - i get the error mentioned here (Uncaught Callback must be a function).

So this is my particular case, but in general i think this error is given when the files included are not present on the system.

For example this will reproduce the issue on windows 10.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>  // here it fails.
#include <netinet/in.h>

void main()
{
    char result = 'P';
}
Whiteout717 commented 5 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.40.1 x64 Electron: 3.1.10 OS: Microsoft Windows 10 Pro Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:157

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1290: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:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

Commands

     -5:11.1.0 gpp-compiler:compile (div.line)
     -4:49.2.0 core:save-as (input.hidden-input)
     -4:09.1.0 gpp-compiler:gdb (div.line.cursor-line)
     -3:47.1.0 core:backspace (input.hidden-input)
     -3:43.8.0 autocomplete-plus:confirm (input.hidden-input)
     -3:43.7.0 snippets:expand (atom-text-editor.editor.is-focused.autocomplete-active)
  2x -3:30 core:move-right (input.hidden-input)
     -3:28.9.0 core:move-left (input.hidden-input)
     -3:21.4.0 autocomplete-plus:confirm (input.hidden-input)
     -3:21.4.0 snippets:expand (atom-text-editor.editor.is-focused.autocomplete-active)
 12x -3:19.5.0 core:backspace (input.hidden-input)
     -2:59.9.0 gpp-compiler:compile (div.line.cursor-line)
 22x -2:52 core:undo (input.hidden-input)
 13x -0:40.6.0 core:delete (input.hidden-input)
     -0:31.9.0 core:save (input.hidden-input)
     -0:17.1.0 gpp-compiler:compile (div.line.cursor-line)

Non-Core Packages

atom-material-ui 2.1.3 
gpp-compiler 3.0.7 
Whiteout717 commented 5 years ago

I'm getting this too. any word on a fix??

sanjay-gitwork commented 5 years ago

I'm getting this too. any word on a fix??

same here

karakunai commented 5 years ago

You guys should be able to compile your projects directly with gpp just fine.

karakunai commented 5 years ago

I'm assuming that even a single line of cin >> "Hello World can trigger this issue, isn't it ? Sometimes the package works, sometimes broken. No matter what the code is about, even the less complex ones.

karakunai commented 5 years ago

Well, anyway. I'm using Solus Linux 4.0 Fortitude, not Windows.

hungnguyen08 commented 5 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.40.1 x64 Electron: 3.1.10 OS: Microsoft Windows 10 Home Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught Callback must be a function

At fs.js:157

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:157:9)
    at Object.fs.writeFile (fs.js:1290: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:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

Commands

     -8:53.6.0 core:confirm (input.hidden-input)
 12x -0:24.4.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

gcc-make-run 0.2.12 
gpp-compiler 3.0.7 
ide-cquery 0.14.0 
grasscannoli commented 5 years ago

+1, Have the same problem, when the program is correct it runs fine, else it gives the uncaught callback thing instead of giving the error txt file.

daeaznar commented 5 years ago

I also have the exact same problem. I know the code is correct, I'm testing with a "hello world", so it's not an error within the code. I just don't know why the "Uncaught Callback must be a function" error keeps showing.

Does anyone has solved this issue?

lovellbrooke77 commented 5 years ago

This is bothering me having this issue. Regardless of just a simple hello world doesn't work

spto commented 5 years ago

Uncaught Callback must be a function

fs.js:157 Hide Stack Trace TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at maybeCallback (fs.js:157:9) at Object.fs.writeFile (fs.js:1290:14) at /Users/.../.atom/packages/save-session/lib/files.coffee:35:9 at /Users/.../.atom/packages/save-session/node_modules/mkdirp/index.js:48:26 at FSReqWrap.oncomplete (fs.js:183:5) The error was thrown from the save-session package. This issue has already been reported.


Atom v 1.40.0 MacOS 10.14.2


It pops out every time when I change anything in the code. But the python code is still able to run, just very annoying.

gerbsta commented 4 years ago

Any updates on this?

sysadminjohn commented 4 years ago

The issue disappears if I go in the plugin settings and disable "Add compiling_error.txt"

nathanblan commented 4 years ago

c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(main.o):(.text.startup+0xc0): undefined reference to `WinMain@16' collect2.exe: error: ld returned 1 exit status

I am also experiencing this problem, and the issue doesn't disappear completely if I go in the plugin settings and disable "Add compiling_error.txt". Instead of two error messages I only get one, which is improvement I guess. The above error message is after turning off the disabling.

wangxuanyu0 commented 4 years ago

Because I have a Chinese input method in my system, I input the semicolon as a full-width symbol when I input the program. When I modified it, I solved this problem, I don't know if it will help you.