Support for C++20

How do I install ncurses and alike without a package tool and with repl refusing to let us use sudo (meaning pacman is out of the question)?

I am growing tired of how limiting and slow Replit is.

If you want to install anything, you need to do it via Nix by editing the replit.nix file.

3 Likes

That did not solve my problem.

1 Like

Hi @whileTRUEpass I’ve been trying out a few ways of installing the ncurses package and I agree this isn’t easy. I’ve reached out to Replit support to find a definitive answer and will reply as soon as I can. Sorry for any inconvenience!

4 Likes

Thanks Ian. Really appreciated you trying to help!

2 Likes

Ok. Thanks to Replit team @coltonatreplit and @JakeAtReplit I’ve got a Repl that you can fork and hopefully work from there.

https://replit.com/@IanAtReplit/C20#main.cpp

Let me know if this resolves your issue and - if so - I’ll go into detail of what needs to happen so anyone else with the issue can fix it in future.

2 Likes

That works. So what was the way to solve this (and potentially other similar situations)?

2 Likes

Awesome news!

The solution is to:

  1. Add pkgs.ncurses to the replit.nix file in the deps section.
  2. Underneath the deps section add the following line:

env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.ncurses ];

  1. In the Makefile add -lncurses to the end of the Main: and Main-debug: sections.

Hope this is helpful!

4 Likes

This is key. I was adding the -lncurses by hand, but handy to realise there is a makefile actually.
Thanks again @IanAtCSTeach

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.