Help with SDL2 in C++ please

I’m intermediate in Python and Luau (Roblox Studio), and decided to start learning C++ for game development. I have Replit core and the AI suggested SDL 2.

At first it was being dumb and explaining to me how to install it on Linux or Windows (even though, haha, this is replit, but I guess the AI forgot). Eventually it finally explained to me how to use Replit.nix, and I correctly installed it like this:

{ pkgs }: {
	deps = [
		pkgs.clang_12
		pkgs.ccls
		pkgs.gdb
		pkgs.gnumake
    pkgs.SDL2
	];
}

It told me to put commas after every item, which I did and got error, then it backpedaled and said for me not to put a comma. Next, this is what it recommended:

g++ main.cpp -o myApplication `sdl2-config --cflags --libs`

I entered it into the shell and got nil. Nothing printed, no reaction, LITERALLY NOTHING IM NOT JOKING.

I could go over every iteration the AI has suggested, I could go over every freaking thing I looked up and tried, but it’s all to no avail.

Am I just jumping the gun and starting to learn something too complex too early?

Thanks for all your help!

Replit uses Linux FYI.

2 Likes

I notice there’s a backtick (‘`’) before sdl2-config, try removing that and seeing if that helps.

Also note, this is invoking the compiler to compile your source code into an executable (myApplication), this command will not actually run the application. To run the application, run ./myApplication in the shell.

1 Like

AFAIK, that’s intentional, it’s to pipe that output as args to the first command.

2 Likes