sdl

c++ undefined reference to static variable [duplicate]

☆樱花仙子☆ 提交于 2019-12-05 05:18:45
This question already has an answer here: static variable link error 2 answers I have no idea why this code isn't working. All the source files compile but when I try to link them the compiler yells at me with an undefined reference error. Here's the code: main.cpp: #include "SDL/SDL.h" #include "Initilize.cpp" int main(int argc, char* args[]) { //Keeps the program looping bool quit = false; SDL_Event exit; //Initilizes, checks for errors if(Initilize::Start() == -1) { SDL_Quit(); } //main program loop while(quit == false) { //checks for events while(SDL_PollEvent(&exit)) { //checks for type

error LNK2001 __imp_fprintf Visual Studio 2015 RC

无人久伴 提交于 2019-12-05 03:45:29
I recently was forced to upgrade from Visual Studio 2015 Pre-Release to Visual Studio 2015 Release Candidate as a result of an expired license. My project was previously building fine, however, now it is not. I am getting only two link errors and I've spent the last two days attempting to address them: 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp_fprintf 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp___iob_func I am linking to SDL2main as I got it from their website, I got the same error with version 2.0.0 and

Fast file copy with progress

假如想象 提交于 2019-12-05 03:42:51
问题 I'm writing an SDL application for Linux, that works from the console (no X server). One function I have is a file copy mechanism, that copies specific files from HDD to USB Flash device, and showing progress of this copy in the UI. To do this, I'm using simple while loop and copying file by 8kB chunks to get copy progress. The problem is, that it's slow. I get to copy a 100 MB file in nearly 10 minutes, which is unacceptable. How can I implement faster file copy? I was thinking about some

Unicode Input Handling in Games

非 Y 不嫁゛ 提交于 2019-12-05 02:41:27
问题 I have a game that requires me to allow players to chat with each other via network. All is well, except the part where players can type in Unicode input. So, the question can be split into two parts: When players type, how do I capture input? I have done this before via the game input handling (polling), however, it is not as responsive as something like Windows Forms. After I capture input into a string, how do I output it using TrueType Fonts? The reason I ask this is because usually, I

SDL/C++ OpenGL Program, how do I stop SDL from catching SIGINT

核能气质少年 提交于 2019-12-05 02:03:09
I am using SDL for an OpenGL application, running on Linux. My problem is that SDL is catching SIGINT and ignoring it. This is a pain because I am developing through a screen session, and I can't kill the running program with CTRL-C (the program the computer is running on is connected to a projector and has no input devices). Is there a flag or something I can pass to SDL so that it does not capture SIGINT? I really just want the program to stop when it receives the signal (ie when I press ctrl-c). Ctrl-C at the console generates an SDL_QUIT event. You can watch for this event using SDL

Should I lock a variable in one thread if I only need it's value in other threads, and why does it work if I don't?

时间秒杀一切 提交于 2019-12-05 01:36:34
问题 I am aware of this question, but I believe my concerns are very different. I recently created an SDL application, using threading and OpenGL. I have one thread running in a loop, which continually updates the state of the objects I draw to the screen. The states are very simple, it is just a boolean array (when the array value is true, I draw it, when it is false, I don't). Currently, I have no mutex lock on any of my variables and everything is working just fine. Even if only half of the

What specifically causes EPrivilege to be raised?

瘦欲@ 提交于 2019-12-05 00:47:13
I'm getting a bug report that some functionality in some music-playing code in an external DLL (SDL_Mixer, in case it helps) that my program uses is raising EPrivilege. The DLL is written in C, so I can't get useful stack trace information out of it with MadExcept, and the problem is not reproducible on my end. And just to make things worse, I don't even know what EPrivilege is . I've never seen it come up in my own code, there's very little information about it available online, and what there is is contradictory. (One explanation says it's raised by the OS if you try to do something with a

SDL configuration in Eclipse IDE

给你一囗甜甜゛ 提交于 2019-12-05 00:03:02
问题 I am trying to get a OpenGL code run on Eclipse in Linux x86 environment (ubuntu): http://nehe.gamedev.net/tutorial/vertex_buffer_objects/22002/ The code would run properly after I input in the command line with g++ main.cpp error.cpp lesson45.cpp -o lesson45 -L/usr/X11R6/lib/ -lGL -lGLU sdl-config --cflags --libs Which is the instruction from the make file. Now I'm attempting to get the code run on Eclipse, I know I must set up linker libraries GL and GLU and linker library directory /usr

How to disable key repeat in SDL2?

北战南征 提交于 2019-12-04 23:36:19
There used to be a function named SDL_EnableKeyRepeat() in SDL, but not anymore in SDL2. I searched around in SDL2-wiki but failed to locate anything relevant. Any ideas? When handling a keyboard event, just filter out any events that are repeat events, i.e. check the repeat field of the SDL_KeyboardEvent of the SDL_Event union. For example: SDL_Event event; while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { quit = true; } if (event.type == SDL_KEYDOWN && event.key.repeat == 0) { if (event.key.keysym.sym == SDLK_d) debug = debug ? false : true; // ... handle other keys } } See https

How do I suppress '-arch', 'x86_64' flags when compiling an OpenGL/SDL application with Waf on OSX?

筅森魡賤 提交于 2019-12-04 22:27:33
I need to suppress "-arch x86_64 -arch i386" flags Waf is passing to GCC. I am building an SDL/Opengl application. If I link against 32 bit SDL runtime I get error Undefined symbols for architecture i386: "_SDL_Quit", referenced from: __del_video in SDL_functions.c.2.o __init_video in SDL_functions.c.2.o If I link against 64 bit SDL runtime, I get error "Undefined symbols for architecture x86_64" The compiler is apparently using flags -arch x86_64 -arch i386 I understand that this causes GCC on OSX to try to compile for both architectures. I want to either compile for 64 bit, or compile for 32