#issues setting up raylib in VS Code

128 messages ยท Page 1 of 1 (latest)

zealous oasis
simple turtleBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

zealous oasis
#

@gloomy nova

gloomy nova
#

You have multiple different compilers installed, that appear to conflict with each other

#

Notice how the log shows both C:\msys64 (from msys2), and C:/raylib/w64devkit that you installed from some raylib thing

#

Get rid of C:\raylib

#

Do you know what a terminal is?

zealous oasis
#

Okay so it seems that I have used both YOUR way (with the pacman command) and that tutorial's way (using the raylib website) to download raylib

gloomy nova
#

In short, msys2 is the best mingw distribution around, and it already lets you install the most common libraries (including raylib), so downloading libraries from elsewhere is usually a waste of time, and takes more effort than downloading them from msys2

zealous oasis
#

How do I get rid of the other files that I installed from the website

#

Just delete them?

gloomy nova
#

Either rename the raylib directory to something else or delete it, yeah

gloomy nova
zealous oasis
gloomy nova
#

Yeah

zealous oasis
#

That's what I copied the whole text from

gloomy nova
#

Yeah. And do you know how to compile manually in the terminal?

#

And just generally, do you know what compilation is?

zealous oasis
#

I don't know the syntax

#

I usually just click the run button and vscode does it for me

gloomy nova
#

Alright, and do you know what compilation is?

zealous oasis
#

I also know linker , it links your file with the library files

gloomy nova
#

Yeah, so the process of converting the C++ code you write (which is just text) to an app that you can actually run

zealous oasis
#

Yea so compiler makes .obj or .exe files smth like that

gloomy nova
#

Alright. So if you type g++ main.cpp -o main.exe in the terminal, it will compile the file called main.cpp to create an executable named main.exe

zealous oasis
#

Well why does clicking the run button not good lmao

gloomy nova
#

Okay, can you try it on a hello world quickly? Without raylib for now

#

Clicking the button does the same thing. But you should first understand how to do it in the terminal, and then tell VSC to run the same command when you click the button. That's all tasks.json is, it tells it what command to run when you press "run"

zealous oasis
gloomy nova
#

Just in case

zealous oasis
#

I am on phone rn

#

My laptop battery died can we talk about this later please

gloomy nova
#

Ah. Alright, ping me when you're back

zealous oasis
#

Thanks btw

#

This convo clarified that what the f is tasks.json

simple turtleBOT
#

@zealous oasis Has your question been resolved? If so, type !solved :)

gloomy nova
zealous oasis
#

@gloomy nova hello sire

#

here is the ss

gloomy nova
#

Ok, and do you know how to run the resulting app in the terminal?

zealous oasis
#

is there a make keyword in cpp

#

i used to write make in C

gloomy nova
#

It should be ./"hello world", try it

#

And generally, avoid spaces in filenames, they can confuse some tools (like Make ๐Ÿ˜› )

gloomy nova
gloomy nova
#

Nice!

zealous oasis
#

yay

gloomy nova
#

Now try that raylib program again

#

I gotta go, but g++ "hello world.cpp" -o "hello world.exe" -lraylib should just work

gloomy nova
#

bing_shrug It should just work now

zealous oasis
#

I express my tremendous gratitude

#

finally it works

zealous oasis
#

@gloomy nova hey you up

#

i got a question

gloomy nova
#

Yeah?

zealous oasis
#

i still have the red squiggl under the header file

#

but the code does compile successfully when i use your command

#

but i dont like that red underline, the editor shows it as an error in my code

#

also there is no autocomplete enabled

#

because of the squiggle

#

is there a fix for this

zealous oasis
#

but now it doenst eve work for the standard C functions SkullCry

gloomy nova
#

Mmm, please run pacman -Qe and show the output

gloomy nova
#

In msys2 terminal

zealous oasis
cunning gate
#

im quite confused

#

their wiki explains how you set it up

gloomy nova
# zealous oasis

Ah, I suggested the wrong package. You need pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra

#

Then restart vsc

zealous oasis
#

thanks!

#

btw is it always better to download all packages from the msys terminal instead of downloading the files from the internet?

simple turtleBOT
#

@zealous oasis Has your question been resolved? If so, type !solved :)

zealous oasis
#

how do i get the command to download them

#

i aint gon ask u everytime lmao

gloomy nova
#

Can't be "all" packages, only the things that msys2 maintainers have provided themselves

gloomy nova
gloomy nova
#

The interpreter probably (python.exe that can run .py files)

#

But you don't want python, you want mingw-w64-ucrt-x86_64-python

zealous oasis
gloomy nova
#

The link explains that

zealous oasis
#

thanks

zealous oasis
#

@gloomy nova ermm hello ๐Ÿ‘‰ ๐Ÿ‘ˆ

#

I want to install raygui where can I find the msys command for it

gloomy nova
#

Use pacman -Ss raygui to search in msys2 packages. This prints nothing, meaning msys2 doesn't provide it

#

If you look through the readme, you'll see that the library is header-only, meaning that you just download it and tell the compiler where to find the .h, using -I

#

So something like g++ ..... -IC:/path/to/raygui/src

#

This will make it compile, but you'll still see the red squiggles. To make Clangd aware of this header, create a file called compile_flags.txt in your project directory and paste -IC:/path/to/raygui/src in there

#

This explains how to deal with completely unknown libraries

zealous oasis
gloomy nova
#

yes

zealous oasis
# gloomy nova yes

btw can you tell me why replacing gcc with g++ in the tasks.json file worked yesterday

gloomy nova
#

When you apply gcc.exe to C++, it switches to C++ mode (so doesn't reject your code outright), but it fails to link the C++ standard library, which is what that error means