Home>

C ++ second day beginner.
I wanted to run the sample program below and started touching C ++.
https://github.com/tokoik/fisheye

Thanks for your patience, but I hope you can forgive me even if this is a rudimentary question because I don't have enough understanding of C ++ basics and projects/libraries.

Environment
Windows10 Pro
VS Code

Error message

After installing MinGW and confirming that "gcc -v" passes,
The above sample code is clone, and c_cpp_properties.json is described as follows

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c ++/x86_64-w64-mingw32",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c ++/backward",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include-fixed",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0 /../../../../ x86_64-w64-mingw32/include",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c++",
                "C: /MinGW/lib/gcc/x86_64-w64-mingw32/7.1.0/include/c ++/tr1",
                "C:/programs/fisheye-master/fisheye-master/libs/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.18362.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.23.28105/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c ++ 17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}


When "gcc fisheye.cpp" was executed, an error occurred.

PS C: \ programs \ fisheye-master \ fisheye-master>gcc. \ fisheye \ fisheye.cpp
In file included from. \ Fisheye \ GgApplication.h: 29,
                 from. \ fisheye \ fisheye.cpp: 2:
. \ fisheye \ gg.h: 32: 10: fatal error: GLFW/glfw3.h: No such file or directory
 #include<GLFW/glfw3.h>
          ^ ~~~~~~~~~~~~~
compilation terminated.


Since "glfw3.h" exists under "C:/programs/fisheye-master/fisheye-master/libs/include/GLFW", we are struggling without knowing the reason.

-Install GLFW (recompiled) to another path and add that path to include path.
・ Rebuilding environment, re-clone sample program
→ Neither of them changed to an error.

Supplemental information

Although it is not supplemental information, "Hello World!" can be output to the console.
I think that there is no mistake in the most basic environment construction itself.

Thanks for your cooperation.

  • Answer # 1

    c_cpp_properties.jsonis an editor setting and not a compiler setting.
    And the C ++ compiler command name isg ++instead ofgcc.
    -Iis used as an option to specify the include path ofg ++.

    Try this.

    g ++ -I header path. \ fisheye \ fisheye.cpp