C :: Implementing GUI On Linux Platform
Jul 6, 2014
I am an experience C programmer but never implement GUI.
I need to make a demo implementation that will be run on Linux and will implement GUI.
I searched the WEB and found lot of information, among is implementing the GUI in HTML and run the API through web browser.
How can I make such implementation in C?
View 2 Replies
ADVERTISEMENT
Aug 21, 2013
I discussed a topic about how to write cross-platform file IO code with a member named Disch for about a year ago. Since I am a beginner I am not sure if the "rules" for doing this has changed or not within C++.
He taught me that differenct CPU:s use different endianness when reading and writing to files. However, why can't the C++ standard file IO functions detect what endianness should be used on the current machine that is running the program? Why didn't the developers who created the standard library develop file IO functions that are cross-platform from the beginning? Have the rules changed since last year?
What I learn is that if you need to store data in files that will be read and written to on different machines, you have to define in the program what endianness should be used. For example, if I needed to store 4 bytes, I had to do this manually with my own functions and define in those which endianness is used.
View 3 Replies
View Related
Apr 18, 2014
System();is bad, I get that. Is there another way, that works across platforms I can use to execute an external program. If not, is there a windows specific way.
View 2 Replies
View Related
Feb 10, 2013
I have Mq4 platform calling functions from DLL some how it doesnt make any differents when I make the call....
// DLL Code
#define WIN32_LEAN_AND_MEAN
#define MT4_EXPFUNC __declspec(dllexport)
using namespace std;
std::string My_String;
#define stringify(mymonths ) # mymonths
[Code] ....
I call this function
bool counts = StartRulls(bars);
Print("counts =",counts );
2013.02.09 23:03:242010.03.31 16:37 My_Mq4.mq4 EURCAD,M5: counts = 1
My result always stays 1
View 4 Replies
View Related
Aug 28, 2013
I am planning to develop a GUI that will run on Windows, Linux, Android & iOS. If am right, VC++ apps don't work on Linux, Android & iOS. Is that correct?
Is there an alternative to that? Which other tool works for GUI development on above mentioned 4 platforms?
View 2 Replies
View Related
Mar 6, 2015
Consider the situation where you're writing a cross-platform library that has functions for creating and manipulating windows. To create a window suitable for OpenGL rendering on Windows you need to call a bunch of different functions such as GetModuleHandle, RegisterClass, CreateWindow, SetPixelFormat, GetDC, wglCreateContextGetDC and so on. All of these functions can potentially fail in one way or another and the Windows documentation doesn't even attempt to list all the different error codes that these functions return.
Let's say your function for creating a window is called create_window(). What kind of error message should you return if any of these platform specific functions fail? It could be something as simple as MultiByteToWideChar failing for some reason when you convert the UTF-8 string your API uses internally to the UTF-16 string that the Windows API expects. I've read that you're not supposed to leak implementation details from your API but what are you suppose to return when an encoding conversion fails that is supposed to be completely transparent to the user of your library?
I've decided to simply return an error code indicating a platform specific error in those cases because there's no way I can anticipate all the different errors that the Windows API might return. The problem with that is that almost all the errors end up being platform errors and without a way to actually tell what the error is then you're basically saying that some unknown error happened. That's not very useful. You could have a function called get_platform_error() that you call to obtain the exact platform error that occurred, but I'm not a fan of such a design and I've had enough trouble with GetLastError() style error handling as it is.
An alternative to that is to create a struct that represents errors and have a field in it where you can store platform specific errors. I believe this is what Apple do with their NSError error object but I'm not sure how I feel about that approach.
Assuming you implement a way to return the platform specific error code then the next part is obtaining a string that describes the error. Your library can obviously not implement error strings for every single error code that Windows might return so you're forced to use FormatMessage. The problem with that function is that you can't force it to return error messages in a specific language and it's not even guaranteed that you can get an English translation of the error string. I don't want to display error messages that mixes English with the current language the operating system uses so how do I solve this problem?
Are there any good open source libraries I could study? The ones I've looked at so far have subpar error handling at best. Many of them don't even check the return values from platform specific functions.
View 8 Replies
View Related
Oct 17, 2013
In my game, I want to display dialogues for exceptions, and I don't really want to use something heavy like Qt, but then I also don't want to write and maintain my own platform-specific code to do it. Is there any library that can display simple message dialogues, just a few lines of text and an OK button, without being complete overkill like a full-blown GUI library?
View 13 Replies
View Related
Feb 10, 2014
Suppose:
cin >> number;
pointer = new type[number + (rand()%number);
So, I wont know the memory allocated for pointer. How can I check it in all OS?
View 4 Replies
View Related
Mar 29, 2013
(C++ question) I need to be able make a compiled code (like a .dll?) which other programmers can use on linux, win,, mac, etc.
The compiled code would simply do calculations and spit out an answer in memory.
I need it to have certain functions that they can easily call and understand (without actually seeing the source).
View 2 Replies
View Related
Sep 12, 2014
I am starting a turn based battle (similar to pokemon) app. How could i make this and make it cross platform. Also is it possible to make it access gps and allow other devices with the same app communicate with each other?
I have done things on the command line but i never made anything with images so i dont even know where to start for this app.
View 4 Replies
View Related
Jul 11, 2014
The project builds on Win32 platform, but not on x64.
Full error message: dllentry.obj : error LNK2001: unresolved external symbol "class CFactoryTemplate * g_Templates" (?g_Templates@@3PAVCFactoryTemplate@@A)
The dllentry.cpp (a DirectShow base class) compiles on both platforms. It contains the external declarations:
extern CFactoryTemplate g_Templates[];
extern int g_cTemplates;
g_Templates[] is then used in two functions:
__control_entrypoint(DllExport) STDAPI DllGetClassObject(__in REFCLSID rClsID,
__in REFIID riid, __deref_out void **pv)
[Code]...
myClass.cpp contains the definitions for the two externals in dllentry.cpp, at top level, just after the includes:
CFactoryTemplate* g_Templates=0;
int g_cTemplates=0;
myClass.cpp also compiles by itself, but the project does not build. I checked all the libraries in the project settings and all seems to be OK, the 64 bit versions are used.
What should I do to make the project build for x64 platform?
View 4 Replies
View Related
Nov 4, 2013
I'm working on a project which uses gtk+ and gtkmm. We use them in preference to MFC because the program needs to be cross-platform. For quite a long time, customers on OS-X and Linux have sometimes complained that the program would crash during shutdown but the Windows version (which I work on) never seemed to suffer. However, I'm now transferring my build environment to a new PC and I'm noticing the same shutdown crashes. It's a bit complicated so let me start with a small example:-
Code:
namespace Whatever {
class B {
public:
virtual ~B();
private:
int bb;
[Code] ....
Suppose I run the above program. When it stops at breakpoint #1 I make a note of the value of pA. Eventually the program reaches breakpoints #2 and #3. At each point my this pointer is exactly the same number. If the value of pA was 0x03604fb0, my this pointer is identical at both stages.
Now let's consider the real example:-
Code:
namespace Gtk {
class Widget {
public:
virtual ~Widget() {}
[Code] .....
Suppose I run the real example. At breakpoint #1 the value of pW is 0x03604fb0. But by the time I reach breakpoint #2 my this point is slightly different:- 0x03604fcc. It doesn't seem right to me and I'm wondering if it might be contributing to our shutdown crashes.
View 6 Replies
View Related
Nov 10, 2014
I am overriding OnSaveDocument in my MFC document class to strip out the carriage returns when saving my app's document to a UNIX file system but not when the user is saving a file to a Windows file system.
Is there a way to determine if the lpszPathName in OnSaveDocument(LPCTSTR lpszPathName) is a UNIX or Windows file system?
Note, I want to avoid hard coding server names and I want to avoid overriding the FileSave dialog and forcing the user to select Windows or UNIX.
View 6 Replies
View Related
Jan 29, 2014
I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..
Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)
My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?
View 1 Replies
View Related
Apr 11, 2013
I have a code that I'd like to debugg it.
Question
1 - What is the correct command line to use the debugger ?
2 - Do I need to install additional software for the debugger ?
if yes what it's name?
I use ububtu 12.4compiling command: gcc abc.c -lpthread -o abc
View 3 Replies
View Related
Feb 22, 2015
This is what so far i did
Code:
#include <stdio.h>#include <string.h>
#include <ctype.h>
#include <bsd/string.h>
int
main(void)
[Code] ....
How to do this Using the fork(), execvp() and waitpid() system calls, launches the requested program and waits until the program has finished.
View 3 Replies
View Related
Sep 22, 2014
I want to use two separate files in 1 program, but cannot get it to work. I don't know if it's my files or the compiling thats wrong. I have never used 2 files in my programs so far. Only used #include <stdio.h>.
Here are my files:
extern_static.c Code: extern int i;
int main(void)
{
[Code]....
View 10 Replies
View Related
Aug 16, 2013
I have a c file which can be compiled in Linux via GCC , but when I compile it in NetBeans via Cygwin or MinGW , it doesn't work and keeps throwing a segmentation fault.
View 14 Replies
View Related
Apr 24, 2013
I have this following piece of code:
int id = 5;
const char *ptrId;
ptrId = ( int_to_str(id) ).getPtr(); // Works in Solaris well
But the above code prints some junk values when I run the same on Linux machine. But the following works well on Linux:
String temp = int_to_str(id);
ptrId = temp.getPtr();
The prototype of getPtr() is:
const char* String::getPtr() const
View 2 Replies
View Related
Jan 23, 2014
I want to create command line game in Linux but I don't know to get the key state. I heard of getch() but that stops the program.
View 1 Replies
View Related
Dec 15, 2014
I want to open an application A from another application B. By opening it, I don't want to open it within B. I found many ways to call an application from within another. However, what I want to do is open the other one(A) simultaneously. How can I achieve this? fork() and exec() seem to open A within B. I am developing a code for Linux and Mac.
View 7 Replies
View Related
Jan 8, 2015
Why is using namespace needed in linux but not in turbo c++?
View 1 Replies
View Related
Feb 17, 2014
I have implemented MD5 checksum algorithm by using C language, but it is resulting correct value in windows but not in Linux?
// Constants are the integer part of the sines of integers (in radians) * 2^32.
const uint32_t k[64] = {
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
[Code] .....
View 2 Replies
View Related
May 13, 2012
I'm trying to implement this on ubuntu, to compile and run only under ubuntu.
I found 100s of other attempts at answering the general question of arrow key press in c++. Nothing solid.
Some recommend using the Readline for the functionality I am trying to implement, but I need to stay clear of GNU licences if I can for this project. And some tips only work on projects for windows machines... for example the conio library.
For linux there may be the option of using the ncurses library which I will take a look at, but I am stubborn and want to implement this myself. It should be an easy straight forward thing to do, which is why I am a bit frustrated at the moment.
Here is my test code so far.
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;
[Code] ....
So! This works... 80% of the problem is solved. If you compile this, g++ under linux, ubuntu in my case, and run. Each keystroke reveals the correct key numbers.
q=113
w=119
when I click on the up key I get,
up = 279165
I thought, I can use this number is a if(int == '279165') to detect the up key.
I was not so lucky... this int is not behaving like an int!
So I modified the code to see it I could carry out an int operation on this number.
I added a 100000 to int i.
cout<< i + 100000;
Code:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;
[Code] .....
Compiling and running this, and pressing the UP key gives the following number.
100027100091100065
Some some sort of array, something like, [27][91][65].
I tried all ways to access these individual numbers, actually the third one for comparison purposes, but no luck.
For completeness sake I list the other arrows.
UP = [27][91][65]
DOWN = [27][91][66]
LEFT = [27][91][68]
RIGHT = [27][91][67]
A little further digging shows that these numbers are derived from the representation of a "multi-char" constant, the data type given when pressing special characters...
Now here is the main problem I have, I can find ANY decent documentation on how to handle and play with "multi-char" .
View 4 Replies
View Related
Apr 5, 2013
I'm trying to build a Linux Process Scheduler from scratch but dont know where to start.
View 1 Replies
View Related
Dec 4, 2014
I'm new in IPC. I would like to implement a signal of a new message, which calls the slot function, eg .:
Code:
msg_on_newMessange(type, &slotFunction);
My code:
Header file: messages.h
Parent file: parent.c
Child file: child.c
How can I do this ?
View 2 Replies
View Related