SDL.h "Program file does not exist" - eclipse

I'm pretty new to c++ (and programming in general) and I'm currently trying to inlcude the "SDL.h" header into a c++ project in Eclipse (I use minGW btw). I've provided the project with the paths to the the header files and the library of SDL. However, whenver I specifically include "SDL.h" and the build then project I get the following Message:
" 'Launching SDL Basic.exe' has encountered a problem. Program file does not exist. "
I'm pretty sure that this has to do with the fact that no .exe file is generated whenever I build the project with SDL.h included. What I don't get is why this happens. When I include some other SDL header, such as SDL_assert, this is not a problem. Then the .exe file is generated just as usual and the program runs just as it should.[enter image description here][1]
http://i.stack.imgur.com/cdV8U.jpg How it looks when SDL.h is included.
http://i.stack.imgur.com/MW7PX.jpg How it looks when something else from SDL is included.

I seem to have fixed the problem. Whenever I ran the program the console window outout " undefined reference to 'Winmain#16' ". So I googled on it and found out that SDL defines its own main function in SDL_main.h, which in total would give me two main functions. To prevent SDL from defining its own main function I had to define the macro SDL_MAIN_HANDLED before I included SDL.h, and look, it worked:
http://i.stack.imgur.com/mNOOE.jpg
If someone can explain this in more detail I'd really appreciate it.

I did a little research and it looks like the undefined reference to WinMain#16 is because SDL is automatically creating a Windows entry point for your application, but you haven't provided the necessary libraries to link in the SDL implementation of that entry point. However, if you intend to use the SDL functionality, you really do need that entry point, because it performs several important initialization steps necessary to leverage the SDL features that you presumably want to use.
Defining SDL_MAIN_HANDLED is a mechanism that would allow you to provide your own Windows entry point (i.e.: WinMain), but that is a more complicated approach (albeit more flexible). This only solves your problem because it happens to prevent "main" from being redefined to "SDL_main" which in turn means that your .cpp file no longer even requires any of the SDL libraries. So it compiles and links, but you won't have any of the SDL functionality you're looking for.
You need to link in the appropriate libraries. See here - it provides some info that might help.

Related

Distribute a glade file inside an application

Before I start, I know of the existence of GResource, however I'm using gtkmm (C++), and I'm not sure if GResource works with C++. I can't find anything along the lines Glib::GResource, and I've been looking for a while.
Anyway, I'm writing a GUI using Gtkmm, and I want to pack the .glade file which I load within the executable, so that the executable can be run without having to have a file next to it. I'm not sure that I completely understand how GResources work, and I can't find any clear instructions anywhere.
So, using Gtkmm, how would I pack a .glade file inside my executable?
update: I've found this. (Gio::Resource), which sounds hopeful, but no documentation.
I've made some more research and found this tutorial and this documentation. Looks like what you need is Gio::Resource::lookup_data_global. Below is C version of my answer.
When something in glib world lacks documentation, it's time to read documentation for c. In short: with the help of glib-compile-resources and a simple xml file you build a .c file, which can be compiled into your application. After that you can use g_resources_lookup_data (resourceS, it's important) to load data.

Why can't I debug into UnityEngine.UI code?

I add the UnityEngine.UI.dll and UnityEditor.UI.dll to my assets folder with their mdb files . also i add the both project to my current project. i am sure all the unity engine ugui code build success, because i debug log in the event system, and it print message. when i want to step into the event system class, i always failed . I find unity will load the code from a build path ,rather than i original code. Why does it do this ? if i want to debug unity engine ugui code, what should i do ?
To debug code, you need two things:
Symbols, the list of all functions, classes, variables used throughout the module. When using C++ symbols are stored in special .pdb files on Windows (and you obviously are using Windows since you are talking about dlls). Symbols in C# (.NET in general) are stored in the .dll itself. Having symbols will let you see the name of functions on the call stack and possibly some variables but nothing more.
Source code of the module.
U3D's source code is proprietary - you need to spend a good amount of money to receive it. And if I am guess to - UnityEngine.UI.dll is a C++ module with stripped (removed) symbols removed.
Thus you have neither, so you can't debug U3D's code at all.
Why would you need to that anyway? If you want to see how the internals of a big game engine work, there are plenty of other options (for example UE4 and Lumberyard). If you are struggling with a problem and you'd like to be able to solve it through debugging...well though luck. Your best bet would be to ask in unity community.

Winsock Coding Issue

I am trying window socket programming in c++.I am using winsock2.h for this purpose.i am doing this in code blocks using GNU GCC and getting errors as shown in attachment as you can see.This is important to know that I trying just client server model.
I am not putting my code here because code is available on msdn(I have just copied from there).I am just providing link
Server code
https://msdn.microsoft.com/en-us/library/windows/desktop/ms737593(v=vs.85).aspx
client code
https://msdn.microsoft.com/en-us/library/windows/desktop/ms737591(v=vs.85).aspx
Posted a comment, but confident enough to make an answer...
The screenshot you included shows Linker errors, so everything is probably compiling correctly. To use WinSock2, your program must link with Ws2_32.lib, which is a standard system library included with the Windows SDK.
SDK stands for Software Development Kit. It contains many header files and libraries that are needed to write software for Windows. Sorry if this is too basic, but... You included the header file WinSock2.h. That header only includes the declarations for all the WinSock functions - just a description of the functions. The function definitions (the code for the functions) is located in a library that you have to "link" with. In some cases you will get source code for a library that you can compile with, but most of the time you will only get a pre-compiled LIB file such as Ws2_32.lib. The Windows SDK contains the LIB files for most of the programs you can write for Windows.
For more information search for "linking", "Win32 libraries", and "dynamic link libraries" (DLLs).

MATLAB Compiler Runtime - how to run it?

I'm supposed to install the MATLAB compiler runtime for class purposes in one of my subjects at University. I have installed it and followed the guide - and this is my silly question: How do I run it? I mean, shouldn't there be some sort of icon or file I need to click to run the actual program?
It shows up on my list of installed programs (under controlpanel -> programs and features), and I have checked the folders where i installed it, but there doesn't seem to be any file or anything I can use to actually run it.
Maybe I misunderstood the purpose of MCR, but any help would be greatly appreciated.
Also, note that I am still new to anything computer-related that is more advanced than basic HTML and opening zipped files.
This question was already correctly answered in the comments by #seb, but to make sure it does not remain open I will post the answer here:
You need to write Matlab code and generate a .dll (or executable
maybe). Then this .dll can be run on a PC that has either Matlab or
MCR installed. But you don't click and start MCR.
And in addition to that I have added a description of how I see the MCR:
Think of the MCR as a bundle of complicated functions. When you compile a program you will just have the references to those functions in your program. Most of the content will actually be drawn from the MCR when your program is run.
That being said, if you actually want students to work with matlab (not just with programs pre built by the teacher) you will actually need to install Matlab, and not the MCR.

What are these errors in BlackBerry 10 Mometics while trying to build LAME?

I'm trying to build with the LAME files but I'm getting these errors on the machine.h file
What's going on?
Short answer : your defines are not what they are supposed to be. The BB10 SDK provides stdlib.h and string.h so you should either :
add a #define STDC_HEADERS 1 somewhere in the include path (inside version.h maybe, because it's seems to be included by everyone else)
add DEFINES += STDC_HEADERS to your .pro file.
You are trying to build your library inside Momentics.
That's usually the fastest way to go.
The issue is that you are skipping the whole configure part of Lame compilation, which was supposed to gather insight about the system you're trying to compile on by trial and error.
I haven't looked at Lame specificaly, but usually configure either creates an header file with all the right defines or add them in the Makefile it creates as arguments to the compiler.
Momentics, on the other way, compiles all .c|.cpp file and link them all together using qmake to handle all Qt specific bits. Momentics sets the right environment, and then there is a lot of scripts to handle all the BB10 processes (package, sign, ..).
So you'll have to provide the missing parts. Usually it's faster to create a new config.h from scratch, but sometimes you may want to use a console with the BB10 SDK environment and do a ./configure manually. Don't forget that the simulator is x86 and the real thing is ARM, so you will have take care of that too (Endianness/optimization issues).