atom-gpp-compiler icon indicating copy to clipboard operation
atom-gpp-compiler copied to clipboard

Uncaught TypeError: Callback must be a function. Received undefined

Open kevingjoni opened this issue 3 years ago • 22 comments

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.54.0 x64 Electron: 6.1.12 OS: macOS 11.2 Thrown From: gpp-compiler package 3.0.7

Stack Trace

Uncaught TypeError: Callback must be a function. Received undefined

At fs.js:142

TypeError [ERR_INVALID_CALLBACK] [ERR_INVALID_CALLBACK]: Callback must be a function. Received undefined
    at maybeCallback (fs.js:142:9)
    at Object.writeFile (fs.js:1175:14)
    at /packages/gpp-compiler/index.js:299:12)
    at ChildProcess.emit (events.js:200:13)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:200:13)
    at Pipe.<anonymous> (net.js:586:12)

Commands

  2x -0:31.1.0 gpp-compiler:compile (input.hidden-input)

Non-Core Packages

gpp-compiler 3.0.7 
ide-c-cpp 0.1.0 

kevingjoni avatar Mar 03 '21 16:03 kevingjoni

Yeah guys help this guy and me IT SO IRITATING

Viraj-M avatar Mar 09 '21 03:03 Viraj-M

I have the same issue

TheLuke02 avatar Mar 10 '21 08:03 TheLuke02

Yes, having the same issue. Can someone walk me through the process of changing PATH to include the gpp compiler? I think that's where my issue lies.

Harumaru75 avatar Mar 11 '21 20:03 Harumaru75

yes i have also face the same problem

SAYAN444-CHAOS avatar Mar 13 '21 05:03 SAYAN444-CHAOS

Bruh why is no one commenting anything about this?

Viraj-M avatar Mar 14 '21 17:03 Viraj-M

like the solution or anything

Viraj-M avatar Mar 14 '21 17:03 Viraj-M

anyone who fixed this ?

0pk0 avatar Mar 15 '21 09:03 0pk0

I also have the same problem

SarahX avatar Mar 16 '21 03:03 SarahX

BRUH i tried changing my path niothing

Viraj-M avatar Mar 16 '21 04:03 Viraj-M

i now started using visual studio code if u cant solve this problem try switching over to visual studio code like the themes are also available and extensions are the same so yeah

Viraj-M avatar Mar 16 '21 09:03 Viraj-M

oh yeah and c programs were running but not in atom

Viraj-M avatar Mar 16 '21 09:03 Viraj-M

My problem was solved when I stopped my existing running program. Make sure u close all other terminals.

JunK4i avatar Mar 23 '21 13:03 JunK4i

nope dosent work for me JunK4i

Viraj-M avatar Mar 24 '21 03:03 Viraj-M

初めまして C++を勉強中のものです。同じエラーが出てコンパイルできません。因みに インストールしたpackagesは、atom-beautify linter-gcc japanese-menu gpp-compilerです。解決方法や設定方法など教えて頂きたいです。

beniodaisuke avatar Apr 01 '21 21:04 beniodaisuke

Any concreat solution?

akramex-dz avatar Apr 23 '21 21:04 akramex-dz

有没有人有办法解决吗 即使您更改PATH,仍然无法正常工作

SarahX avatar Apr 23 '21 21:04 SarahX

Please refer this thread for instructions on linking the math library: https://github.com/kriscross07/atom-gpp-compiler/issues/100

SasidharanGS avatar Apr 27 '21 10:04 SasidharanGS

Please refer this thread for instructions on linking the math library: #100

Thanks a lot. I have same issue and this solved for me.

Fitap avatar May 09 '21 15:05 Fitap

I have solved my problem. Open Linux terminal (Ctrl+Alt+T) and enter: sudo apt install gcc g++ (Y/n): Y

Full description:

Linux

The GNU Compiler Collection may come with your distribution. Run which gcc g++ to find out.

If that command does not output

/usr/bin/gcc /usr/bin/g++ you will need to install it.

For RHEL-based distros, run sudo dnf install gcc gcc-c++

For Debian-based distros, run sudo apt install gcc g++

For Arch-based distros, run sudo pacman -S gcc

RakibOFC avatar May 17 '21 08:05 RakibOFC

Ok so I've got a solution. Basically, the C and C++ compilers are different (obviously), and so far only 3 types of reasons might be causing this error. Try and follow the steps and I hope the thing starts working.

  1. Check your system path for errors. It is suposed to have "C:\Program Files\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\bin".
  2. The function Atom is trying to call does not exist in the compiler you are invoking, So. make sure that in the package settings, the C compiler is set to "gcc" and the C++ compiler is set to "g++".
  3. Try reinstalling MingW compiler.

Supragy352 avatar May 23 '21 03:05 Supragy352

Settings > Packages > View Code under gpp compiler

In the file index.js line 299 changed to

fs.writeFile(path.join(info.dir, "compiling_error.txt"), (err) => {});

line 427 changed to

fs.unlink(path.join(info.dir, "compiling_error.txt"), (err) => {});

Then disabling and re-enabling the package from settings solved the issue.

mrityunjai01 avatar Nov 25 '21 16:11 mrityunjai01