DevLibs | repo contains libraries for random electronic modules
kandi X-RAY | DevLibs Summary
kandi X-RAY | DevLibs Summary
This repo contains libraries for electronic modules - created for different platforms and devices; written mostly in C or C++, what allows to easily port them to different platform.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of DevLibs
DevLibs Key Features
DevLibs Examples and Code Snippets
Community Discussions
Trending Discussions on DevLibs
QUESTION
I'm trying to set up a SDL2 and C development environment on Windows 10 with MinGW-w64.
When trying to run the basic c app with SDL initialization, it compiles without warnings but fails to run afterwards, again without any warnings. Executable just exits.
Here's the source:
...ANSWER
Answered 2020-Aug-05 at 09:23Aside from startup issue with missing dynamic library, you seem to be mislead (arguably by SDL actually being misleading in that aspect) that your b main
in gdb sets breakpoint in your main
function. That's not the case as SDL redefines main
to SDL_main
, so if you have #include "SDL2.h"
or something similar and SDL have main wrapper implemented for your operating system - your function gets renamed. Internally main
(or wmain
, or WinMain
, or whatever target system uses as user-defined code entry point) is implemented in SDL2main
library that you link with, and it calls SDL_main
(your code).
TL;DR use b SDL_main
in gdb instead.
Second point is why you don't see output text. That's once again windows specific, basically because you've build "GUI" app, which is different from "console" app, and don't really have its stdout
associated with console output. Output is still there but you can't see it - but it can be redirected to other program or file, e.g. your_program.exe | more
or your_program.exe > stdout.txt
. There are ways to reconnect stdout to console (some freopen
with CON
magic, as I recall), or you can just build console program instead with -Wl,-subsystem,console
.
As a side note, -w
compiler flag (that could be loosely read as "don't ever warn me about any potential problems with my code as I'm 100% sure it is absolutely perfect and all your warnings are unjustified complaints about my perfect code" (sorry)) is a really really bad idea, with some very rare exceptions. Compilers, especially gcc and clang, are very good at giving warnings in places where it really matter, allowing you to spot mistakes early. You want more warnings (e.g. -Wall -Wextra
, probably more), not no warnings at all. And while we're at it, OBJS
in makefile logically should mean object files, not sources (of course you technically can call your variables anything you like, it is just misleading).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DevLibs
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page