#issues setting up raylib in VS Code
128 messages ยท Page 1 of 1 (latest)
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.
@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?
Yes, I downloaded the latter from the raylib website
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
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
Well I have done that pacman thing
How do I get rid of the other files that I installed from the website
Just delete them?
Either rename the raylib directory to something else or delete it, yeah
Does renaming it to raylib_1 work
Yeah
Yes the terminal is the console right
That's what I copied the whole text from
Yeah. And do you know how to compile manually in the terminal?
And just generally, do you know what compilation is?
No, I don't know how to run that g++ command
I don't know the syntax
I usually just click the run button and vscode does it for me
Alright, and do you know what compilation is?
Yes, the process of converting the code to machine language ik
I also know linker , it links your file with the library files
Yeah, so the process of converting the C++ code you write (which is just text) to an app that you can actually run
Yeah
Yea so compiler makes .obj or .exe files smth like that
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
Okay
Well why does clicking the run button not good lmao
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"
Ahh
I see
So does it work?
Yeah it says hello world
Can you screenshot your terminal?
Just in case
I just plugged it in haha
Thanks btw
This convo clarified that what the f is tasks.json
@zealous oasis Has your question been resolved? If so, type !solved :)
So you mean you can continue?
Ok, and do you know how to run the resulting app in the terminal?
no hehe
is there a make keyword in cpp
i used to write make in C
It should be ./"hello world", try it
And generally, avoid spaces in filenames, they can confuse some tools (like Make ๐ )
Yeah, Make works for C++ too. But I'd avoid it for now
Nice!
yay
Now try that raylib program again
I gotta go, but g++ "hello world.cpp" -o "hello world.exe" -lraylib should just work
If this works, you can then use the same command in your tasks.json. This explains how: https://github.com/HolyBlackCat/cpp-tutorials/blob/master/tooling/articles/configuring_vsc_tasks.md
are you gonna be back soon 
It should just work now
Thanks a lot Sir
I express my tremendous gratitude

finally it works
Yeah?
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
hey i installed clangd and also did the disabling intellisense part after installing the extension
but now it doenst eve work for the standard C functions 
Mmm, please run pacman -Qe and show the output
In msys2 terminal
im quite confused
their wiki explains how you set it up
https://github.com/raysan5/raylib/wiki/Using-raylib-in-VSCode for vscode and for whatever ide you want too
Ah, I suggested the wrong package. You need pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra
Then restart vsc
yeah now it works
thanks!
btw is it always better to download all packages from the msys terminal instead of downloading the files from the internet?
@zealous oasis Has your question been resolved? If so, type !solved :)
MSYS2 is way easier
are all packages available on msys
how do i get the command to download them
i aint gon ask u everytime lmao
Can't be "all" packages, only the things that msys2 maintainers have provided themselves
pacman -Ss ... searches by package name, and I think pacman -F ... searches by contents
Most packages that you install should have their names start with mingw-w64-ucrt-x86_64-, for explanation see https://stackoverflow.com/q/76552264/2752075
what does python mean
The interpreter probably (python.exe that can run .py files)
But you don't want python, you want mingw-w64-ucrt-x86_64-python
whats the difference
The link explains that
@gloomy nova ermm hello ๐ ๐
I want to install raygui where can I find the msys command for it
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
I recommend reading https://github.com/HolyBlackCat/cpp-tutorials/blob/master/tooling/articles/using_libraries.md
Contribute to HolyBlackCat/cpp-tutorials development by creating an account on GitHub.
This explains how to deal with completely unknown libraries
so you mean download raygui from the internet
yes
btw can you tell me why replacing gcc with g++ in the tasks.json file worked yesterday
gcc.exe is a C compiler ("gnu C compiler"), while g++.exe is a C++ compiler. But "GCC" also stands for "gnu compiler collection", which both are parts of, which adds to the confusion
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
