Your First Program

Computer: Windows10 64 bit
I installed latest Version of VS Code, installed raylib mingw 64 bit (version x.7 instead x.5 as in the video) and finally installed intellisense for C/C++.

I created the hello.cpp file added some code:

#include
//edit 1: the pasted code contains cstdio in the bracktes but this is not shown here
int main()

{

printf("Hello my name is Jens.\n");

printf("42\n");

printf("Whats the question?\n");

}

I clicked on Run Build Task… and get the following message:

Executing task: C/C++: g++.exe build active file <

Starting build…
C:\raylib\mingw\bin\g++.exe -g D:\GameDev\vscode-template\hello.cpp -o D:\GameDev\vscode-template\hello.exe
Build finished successfully.

Terminal will be reused by tasks, press any key to close it.
then i hit space and type .\hello

so far i do not receive any output as in the video, I would expect the output of the 3 printf strings,this is what I get:
Windows PowerShell
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Lernen Sie das neue plattformübergreifende PowerShell kennen – https://aka.ms/pscore6

PS D:\GameDev\vscode-template> .\hello
PS D:\GameDev\vscode-template>

If I try to run the hello.exe file from the command promt I receive an error message that the code cannot be executed due to missing libgcc_s_dw2-1.dll file.

in the mingw installation of raylab I can find the file:

Edit2:
If i run the program in debug mode I get the follwing terminal outbut:
PS D:\GameDev\vscode-template> & ‘c:\Users\Jens.vscode\extensions\ms-vscode.cpptools-1.5.1\debugAdapters\bin\WindowsDebugLauncher.exe’ ‘–stdin=Microsoft-MIEngine-In-4voatjyh.iv0’ ‘–stdout=Microsoft-MIEngine-Out-5k14xona.m4n’ ‘–stderr=Microsoft-MIEngine-Error-plni2r1f.mfw’ ‘–pid=Microsoft-MIEngine-Pid-aoomgmsl.jak’ ‘–dbgExe=C:/raylib/mingw/bin/gdb.exe’ ‘–interpreter=mi’

Debug console shows:
=thread-group-added,id=“i1” GNU gdb (GDB) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type “show copying” and “show warranty” for details. This GDB was configured as “i686-w64-mingw32”. Type “show configuration” for configuration details. For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type “help”. Type “apropos word” to search for commands related to “word”. Warning: Debuggee TargetArchitecture not detected, assuming x86_64. =cmd-param-changed,param=“pagination”,value=“off”

[New Thread 7380.0x4e6c]

[New Thread 7380.0x3434]

[New Thread 7380.0x5bc]

[New Thread 7380.0x4898]

Thread 1 hit Breakpoint 1, main () at hello.cpp:4

4 printf(“Hello my name is Jens.\n”);

Loaded ‘C:\WINDOWS\SYSTEM32\ntdll.dll’. Symbols loaded.

Loaded ‘C:\WINDOWS\System32\kernel32.dll’. Symbols loaded.

Loaded ‘C:\WINDOWS\System32\KernelBase.dll’. Symbols loaded.

Loaded ‘C:\WINDOWS\System32\msvcrt.dll’. Symbols loaded.

What is missing that I do not get the output from printf as expected?

Edit 3:
If i select run active file from the terminal menue Dev-C++ is loaded, if i compile the code withthis tool I get the desired output. if I try to run the program from the next chapter, it fails in dev-C++ because it doesn’t know raylib, so I guess the overall failure is a config problem, anybody can support what i have to adapt in VS code config?

Edit 4:

#include “raylib.h”

int main()

{
InitWindow(800,600,“Hello”);
}

If i run build task on the axe_game.cpp file from the next chapter i receive the following error:
Starting build…
C:\raylib\mingw\bin\g++.exe -g D:\GameDev\vscode-template\axe_game.cpp -o D:\GameDev\vscode-template\axe_game.exe
C:\Users\Jens\AppData\Local\Temp\ccG4c0hB.o: In function main': D:/GameDev/vscode-template/axe_game.cpp:5: undefined reference to InitWindow’
collect2.exe: error: ld returned 1 exit status

Build finished with error(s).
The terminal process failed to launch (exit code: -1).

railib.h is included and if i type InitWindow I get the info about input parameters…

I seem to be having this same issue. Compiling shows no errors, but when running hello.exe I receive:

hello

This happens regardless of whether I compile using VSCode or manually using ‘g++’. Interestingly, when I compile with ‘gcc’ it works fine.

OS is Microsoft Windows [Version 10.0.19042.1110], and raylib installer is v370.

Suggestions on what to check? Thanks.

I had to set C:\raylib\mingw\bin in my windows PATH.

Heres a link. Should help. I added it to both User and System variables but probably only needed System.

How To Add To PATH in Windows 10

Oh and reboot after.

4 Likes

Ok,

the initial problem is solved, with the path envoronment modification both scenarios work ,Terminal and Execution from command promt for the hello example now give the expected result.
I will move the second problem to a new request.
How can I set this request to fixed?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Hi Guys,

I have highlighted this to Stephen as i found this issue much earlier.
You dont need to add these as you will at some point get a message in the bottom right that shell needs a reboot to add the hosts.
Shell being a reference to the OS and you just need to reboot the machine to get this done.

Hope this helps

Privacy & Terms