Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nbersiller

Pages: [1]
1
A: do you have a floppy drive? ;D

Quote
IA:/include/SFML/include
This seems ode, why do you have an include folder that contains an SFML folder that includes an include folder?

How are you building and how are you running the application?

Please help me. I managed to make cmake work, but how do i use it? I modified my tasks.json file, i don't know if it's better now

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile SFML executable",
            "type": "cppbuild",
            "command": "g++",
            "args": [
                "-o",
                "${workspaceFolder}/porcoddio.exe",
                "-IC:/Users/user/Documents/c++!/diocaneporcodio/include",
                "-LC:/lib/",
                "${workspaceFolder}/porcoddio.cpp",
                "-lsfml-graphics",
                "-lsfml-window",
                "-lsfml-system"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
        }
    ]
}

2
A: do you have a floppy drive? ;D

Quote
IA:/include/SFML/include
This seems ode, why do you have an include folder that contains an SFML folder that includes an include folder?

How are you building and how are you running the application?

I just extracted the files from the SFML release on github, and created an include folder out of habit where i put the SFML include folder. I'm running the application with the visual studio code run button, nothing much

3
Stop using include/ for the header it's wrong :D

You need to have CMake itself installed on your system as well. Also read the documentation of the extension to see how to use it

PS C:\c++\main> make
g++ -Isrc/include/ -c main.cpp
There's no linking of SFML, nor does it point to the SFML include directory.
What does your tasks.json look like?

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile SFML executable",
            "type": "cppbuild",
            "command": "g++",
            "args": [
                "-o",
                "${workspaceFolder}/porcoddio.exe",
                "-IA:/include/SFML/include/",
                "-LA:/lib/",
                "${workspaceFolder}/porcoddio.cpp",
                "-lsfml-graphics",
                "-lsfml-window",
                "-lsfml-system"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
        }
    ]
}

Here is the tasks.json

4
So it then tells you it can still not find the header?

What's the contents of your tasks.json?

I still recommend the CMake way mentioned above.

With Cmake it still gives the same error
https://ibb.co/Pj3S3J0

PS C:\c++\main> make
g++ -Isrc/include/ -c main.cpp
main.cpp:1:10: fatal error: include/SFML/Graphics.hpp: No such file or directory
    1 | #include <include/SFML/Graphics.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:2: all] Error 1

Also tried "cmake" command and it doesn't recognize it, the extension is installed though.
https://ibb.co/hcbQsYN

5
If you look at any tutorials, documentation or even the StackOverflow answer linked, you'll notice, that they're all using #include <SFML/Graphics.hpp> without the include/ directory.
Have you tried that? ;)

I personally, I highly recommend using the CMake extension with VS Code and something like the CMake SFML Template. Only "downside" is that you need to use the CMake commands from the command palette instead of the run button in VS Code.

Yes that's the thing, not only did #include SFML/Graphics without include directory not work (causing the same problem), it also gave me squiggly lines, so idk really

6
If i try to run the most basic tutorial program listed in the SFML website i get this error.

porcoddio.cpp:1:10: fatal error: include/SFML/Graphics.hpp: No such file or directory
    1 | #include <include/SFML/Graphics.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~



Please note that vscode recognizes the path when i type it in, it even suggests me the name of "Graphics.hpp", and there are no squiggly lines underneath #include <include/SFML/Graphics.hpp>in the text editor, it's only when i try to compile it that the terminal gives me this error, and the default path in the intellisense configuration is set to the correct one. I tried everything i could think of, i've been at it for 6 hours. https://stackoverflow.com/questions/72580240/include-sfml-library-in-vscode-sfml-graphics-hpp-no-such-file-or-directory-gcc I also found this question which is similar to mine, and i tried the solution. It didn't work, still the same problem What is this? Here is my code:


#include <include/SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

Pages: [1]