Skip to content
← Back to Community
Why doesn't nCurses work on my repl?
Profile icon
Terra361

I am using the nCurses library on my project. I am trying to generate pixels in the console, but all I get when I run the code is Undefined reference to many of my lines. What is happening?
By the way, I am still learning how to do a lot of this.
Also my code is not even remotely cleaned up, so it might just be that I need to finish writing the script.

Answered by DynamicSquid [earned 5 cycles]
View Answer
Voters
Profile icon
ViniciusRocha5
Profile icon
Terra361
Comments
hotnewtop
Profile icon
DynamicSquid

Okay, so to compile and run your program, type this in the console:

g++ -o main main.cpp -lncurses; ./main

Or if you want, create a new file called .replit, and type this in:

run="g++ -o main main.cpp -lncurses; ./main"

Then just hit the run button and it should work!

This is because you have to link the curses library since it's an external one and g++ can't do it for you automatically.

Profile icon
DynamicSquid

You have to link the curses library manually. One sec, lemme try to get it working

Profile icon
Coder100

Does repl.it maybe not support ncurses.h?

Profile icon
Terra361

@Coder100 I thought so. It accepts ncurses.h as a file.