• Najnowsze pytania
  • Bez odpowiedzi
  • Zadaj pytanie
  • Kategorie
  • Tagi
  • Zdobyte punkty
  • Ekipa ninja
  • IRC
  • FAQ
  • Regulamin
  • Książki warte uwagi

Visual Studio

VPS Starter Arubacloud
0 głosów
294 wizyt
pytanie zadane 10 marca 2020 w Systemy operacyjne, programy przez tommm98 Nowicjusz (120 p.)
edycja 10 marca 2020 przez tommm98

Witam ,

Mam problem z Visual Studio 2017 robię dokładnie wszystko jak pokazuje p.Krzysztof Szenk w kursie wprowadzenie do programowania grafiki komputerowej.

Przy kompilacji nie wyskakuje mi okno które stworzyłem. Natomiast wyskakuje mi taki komunikat :The program '[12240] Project1.exe' has exited with code 1 (0x1).Nie wiem co z tym robić. Z góry dziękuje.

 

 

#include <GLFW/glfw3.h>

constexpr int WIN_SZ_X = 800, WIN_SZ_Y = 600;

int main()
{
    
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

       
    GLFWwindow* window = glfwCreateWindow(WIN_SZ_X, WIN_SZ_Y, "bLA", nullptr, nullptr);

    if (!window)
        return 1;

    glfwMakeContextCurrent(window);

    while (!glfwWindowShouldClose(window))
    {
        if (glfwGetKey(window, GLFW_KEY_Q) == GLFW_PRESS)
            glfwSetWindowShouldClose(window, 1);
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glfwTerminate();
    
    return 0;
}

 

komentarz 10 marca 2020 przez tangarr Mędrzec (154,780 p.)

Kilka uwag:
1. Problem nie dotyczy Visual Studio tylko problemów w kodzie.
2. Na takich screenach nic nie widać. Wrzuć kod programu do bloczku code
 

komentarz 10 marca 2020 przez tommm98 Nowicjusz (120 p.)
Wpisałem kod odręcznie.
komentarz 10 marca 2020 przez tommm98 Nowicjusz (120 p.)
Dzieki :)

1 odpowiedź

0 głosów
odpowiedź 10 marca 2020 przez tangarr Mędrzec (154,780 p.)

Nie udało ci się wykonać funkcji glfwCreateWindow
Sprawdź jaki błąd został wygenerowany https://www.glfw.org/docs/latest/intro_guide.html#error_handling

Prawdopodobnie wystarczy dodać kod:

if (!window) {
    const char* description;
    int code = glfwGetError(&description);
 
    std::cout << "Wystapil blad " << code;
    if (description)
        std::cout << ": " << description;

    std::cout << std::endl;
    return 1;
}

 

 

komentarz 10 marca 2020 przez tangarr Mędrzec (154,780 p.)
Jeżeli użyłeś OutputDebugStringA w taki sposób jak ci zasugerowałem to powinieneś dostać dodatkową linijkę z opisem błędu w gdzieś w środku outputu.
Bez tego nie jestem w stanie powiedzieć dlaczego nie możesz stworzyć okna.
komentarz 10 marca 2020 przez tommm98 Nowicjusz (120 p.)

Error:Unable to open file

C:\Users\Tomasz\source\repos\Project1\Project1\Debug\Source.obj. Error code = 0x80070002.

C3861 'OutputDebugStringA': identifier not found 

Takie błędy mi wyskakują być może z powodu tego ze nie w tym miejscu umieściłem Twój kod.Dzieki za poświecony czas.

A kod wygląda następująco:

#include <GLFW/glfw3.h>
#include <iostream>

#include <sstream>

void logError(int code, const char* message) {
	std::stringstream str;
	str << "Wystapil blad " << code;
	if (message)
		str << ": " << message;
	OutputDebugStringA(str.str().c_str());
}



constexpr int WIN_SZ_X = 200, WIN_SZ_Y = 300;

int main()
{


	glfwInit();
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);


	GLFWwindow* window = glfwCreateWindow(WIN_SZ_X, WIN_SZ_Y, "bLA", nullptr, nullptr);

	if (!window)
		return 1;

	glfwMakeContextCurrent(window);
	gladLoadGL();


	
	if (!window) {
		const char* description;
		int code = glfwGetError(&description);
		logError(code, description);
		return 1;
	}

	glfwTerminate();


	return 0;
}

 

komentarz 10 marca 2020 przez tangarr Mędrzec (154,780 p.)

dodaj nagłówek windows.h

#include <windows.h>

 

komentarz 10 marca 2020 przez tommm98 Nowicjusz (120 p.)

Po wpisaniu kodu :

#include <GLFW/glfw3.h>
#include <iostream>
#include <Windows.h>
#include <sstream>

void logError(int code, const char* message) {
	std::stringstream str;
	str << "Wystapil blad " << code;
	if (message)
		str << ": " << message;
	OutputDebugStringA(str.str().c_str());
}



constexpr int WIN_SZ_X = 200, WIN_SZ_Y = 300;

int main()
{


	glfwInit();
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);


	GLFWwindow* window = glfwCreateWindow(WIN_SZ_X, WIN_SZ_Y, "bLA", nullptr, nullptr);

	if (!window)
		return 1;

	



	if (!window) {
		const char* description;
		int code = glfwGetError(&description);
		logError(code, description);
		return 1;
	}

	glfwTerminate();


	return 0;
}

Na wyjsciu otrzymuje :

'Project1.exe' (Win32): Loaded 'C:\Users\Tomasz\source\repos\Project1\Debug\Project1.exe'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\win32u.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32full.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp_win.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\umpdc.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
The thread 0x90c has exited with code 0 (0x0).
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'Project1.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\winmmbase.dll'
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput8.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\XInput1_4.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\InputHost.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreMessaging.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\CoreUIComponents.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WinTypes.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntmarta.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DXCore.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\amdhdl32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\amdhdl32.dll'
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig75icd32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'Project1.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
The thread 0x314c has exited with code 1 (0x1).
The thread 0x10e4 has exited with code 1 (0x1).
The thread 0x1eac has exited with code 1 (0x1).
The thread 0x2540 has exited with code 1 (0x1).
The thread 0x3154 has exited with code 1 (0x1).
The thread 0x23a0 has exited with code 1 (0x1).
The thread 0x1dfc has exited with code 1 (0x1).
The thread 0x11d0 has exited with code 1 (0x1).
The thread 0xdc8 has exited with code 1 (0x1).
The program '[3012] Project1.exe' has exited with code 1 (0x1).

 

komentarz 10 marca 2020 przez tangarr Mędrzec (154,780 p.)
Twój program kończy się w linii 31. Wyrzuć linie 30 i 31.
Być może to z przemęczenia. Ale jeżeli tego nie widzisz to zadaj sobie pytanie czy jesteś gotów na programowanie grafiki. Być może musisz wrócić do podstaw C++.

Podobne pytania

0 głosów
3 odpowiedzi 93 wizyt
+1 głos
0 odpowiedzi 212 wizyt
0 głosów
0 odpowiedzi 170 wizyt
pytanie zadane 8 września 2022 w Systemy operacyjne, programy przez MisticVoid Początkujący (490 p.)

92,451 zapytań

141,261 odpowiedzi

319,073 komentarzy

61,853 pasjonatów

Motyw:

Akcja Pajacyk

Pajacyk od wielu lat dożywia dzieci. Pomóż klikając w zielony brzuszek na stronie. Dziękujemy! ♡

Oto polecana książka warta uwagi.
Pełną listę książek znajdziesz tutaj.

Akademia Sekuraka

Akademia Sekuraka 2024 zapewnia dostęp do minimum 15 szkoleń online z bezpieczeństwa IT oraz dostęp także do materiałów z edycji Sekurak Academy z roku 2023!

Przy zakupie możecie skorzystać z kodu: pasja-akademia - użyjcie go w koszyku, a uzyskacie rabat -30% na bilety w wersji "Standard"! Więcej informacji na temat akademii 2024 znajdziecie tutaj. Dziękujemy ekipie Sekuraka za taką fajną zniżkę dla wszystkich Pasjonatów!

Akademia Sekuraka

Niedawno wystartował dodruk tej świetnej, rozchwytywanej książki (około 940 stron). Mamy dla Was kod: pasja (wpiszcie go w koszyku), dzięki któremu otrzymujemy 10% zniżki - dziękujemy zaprzyjaźnionej ekipie Sekuraka za taki bonus dla Pasjonatów! Książka to pierwszy tom z serii o ITsec, który łagodnie wprowadzi w świat bezpieczeństwa IT każdą osobę - warto, polecamy!

...