Visual C++ :: Cross Platform Program - Make A Note Of Value Of PA

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


ADVERTISEMENT

C++ :: How To Make (compiled) Code That Other Programmers Can Use (cross-platform)

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

C++ :: Turn Based Game - How To Make It Cross Platform

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

Visual C++ :: Cross Platform GUI Development

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

C++ :: Cross Platform Way To Execute A Program?

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

Visual C++ :: How To Determine Cross Platform Type During File Save

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

C++ :: Write Cross-platform File IO

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

C++ :: Cross Platform Library For Simple Dialogues

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

C++ :: Checking Dynamic Memory Cross-platform?

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

Visual C++ :: Mq4 Platform Calling Functions From DLL

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

Visual C++ :: Unresolved External Symbol When Building For X64 Platform

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

C/C++ :: How To Cross Compile A GTKmm (Hello World) Program

Jun 20, 2014

I'm using ubuntu 14.04 and I want to cross compile this simple GTKmm program for Windows:

#include <gtkmm.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app =
Gtk::Application::create(argc, argv,
"org.gtkmm.examples.base");
Gtk::ApplicationWindow window;
return app->run(window);
}

I don't know how to do this...When I use this command:

x86_64-w64-mingw32-g++ main.cpp -o hello.exe `x86_64-w64-mingw32-pkg-config gtkmm-3.0 --cflags --libs`

I get this error:

In file included from /usr/include/cairomm-1.0/cairomm/fontoptions.h:26:0,
from /usr/include/cairomm-1.0/cairomm/surface.h:37,
from /usr/include/gdkmm-3.0/gdkmm/pixbuf.h:40,
from /usr/include/gdkmm-3.0/gdkmm/dragcontext.h:31,
from /usr/include/gtkmm-3.0/gtkmm.h:90,
from main.cpp:1:
/usr/include/cairo/cairo-ft.h:50:35: fatal error: fontconfig/fontconfig.h: No such file or directory
#include <fontconfig/fontconfig.h>

[code]....

View 10 Replies View Related

C++ :: ATM Project - Get Withdrawal Of Money And Show Number Of Note

Feb 8, 2014

I have been given to do a simple ATM project which is containing of getting a number of notes in the ATM (100, 500, 1000). Get the withdrawal of money and show the number of note. Here what i got so far. I may need to use a loop but I am not sure how to put it into this.

#include <stdio.h>
#include <conio.h>
int main() {
int a=10, b=10, c=10;
int q;

[Code] ....

But the problem is i don't know how to make the code continue with the process with the amount of notes that is left from the previous input. The program will just stop but i really want it to be able to input new withdrawal amount so that it can decrease the note each time i withdrawal the money.

View 1 Replies View Related

Visual C++ :: Creating Program To Make Sine Function Without Any Library Other Than Iostream?

Nov 10, 2012

My assignment is to create a C++ Program to find the sine of a number without any library other than iostream by using Taylor Series:

sin (x) = (x/1!) - (x^3/3!) + (x^5/5!) - (x^7/7!) + (x^9/9!) ...... (x^n/n!).

Here is what i have done till now:

#include <iostream>
double fact (int f); //declaration of factorial function
double power(double x, int y); //declaration of power function
double sin(int x); //declaration of sine function
//double cos(int x); //declaration of cosine function
//double tan(int x); //declaration of tangent function

[code]....

View 3 Replies View Related

Visual C++ :: Reverse Sentence - How To Make Program Non Case-sensitive Using Vectors

May 25, 2014

I had been tasked to create a program that reverses a word i.e.

cat
tac

How to make my program non case-sensitive using vectors?

Code:
// BackWardsSentence.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
string BackWords (string sentence);
int BackSentence (string sentence);
string BackWords1 (string sentence);

[Code] .....

View 2 Replies View Related

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 View Related

C++ :: How To Get The Cross Product

Oct 10, 2014

I am trying to compute the cross product of an 1x6 column vector "D" with a 6xN matrix "S".

vector< vector<float> > D(1, vector<float>(6));
vector< vector<float> > S(6, vector<float>(10)); // Example where N = 10
float cProduct = D*S; // ?

The last line fails, so I'm wondering how you would get the cross product?

View 2 Replies View Related

C :: API Design - Handling Platform Specific Errors

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

C :: Best Process For Cross Compiling Application

Oct 26, 2013

I'm creating a small command line game in C. I have never done anything cross platforms, but this is small enough (so far) that it might not be too bad.

When I am done, I'm not sure how it will be distributed: Either I will just send people the C files and say "compile on your system with these options", or I will just have executables for various systems. Probably Windows 7/8, Ubuntu, CentOS, and whatever I can find to test on.

I right now I'm testing/developing on Windows 7 using MinGW. So my questions are: while I'm developing, how should I be compiling/testing it?

View 4 Replies View Related

C# :: API That Convert 2D Cross Sections Into 3D Shape

Mar 1, 2014

I have cross sections in the form of rectangles in the XY plane formed from two point (top left, bottom right) as well as their Z position. I'd like finding some sort of API that can extrude a basic linear-average-approximated 3D shape (preferably eventually into STL format) from these points. I've tried googling but to no avail. The aim is to build a 3D shape from 2D wireframes.

View 2 Replies View Related

C :: Boolean Value Cross-functional In Game TicTacToe

Dec 11, 2014

Why something doesn't work without setting global variables. I want to know how to deliver values for example my boolean value "ende" (means end) from the function in line 99

Code:
bool pruefeGewinn() or in line 116 Code: bool spielfeldVoll() to the main function for using it there for Code: } while (ende != true); in line 164.

How to return it correctly?

Here is the Code of the game TicTacToe.

Code:
#include <stdio.h> // In- and Output
#include <stdlib.h> // Implementation of many functions
#include <stdbool.h> // Allows in C99 True and False as Boolean
#include <time.h> // Allows using Random by time

/*----------------------- Constants -------------------------*/

#define KANTENLAENGE 3
#define STRING 100

[Code] .....

View 6 Replies View Related

C++ :: Compute Area Of A Triangle Using Cross Product

Jan 8, 2015

I have to write some cpp program which computes area of a triangle using cross product,we give 3 vertices as R2 and 3 edges as double.

I am beginning like this;

#include <iostream>
#include "R2.h"
#include <cmath>
using namespace std;
double area ( R2 *A,double *z)

[Code] .....

View 5 Replies View Related

Visual C++ :: Unable To Make Addon To IE

Dec 7, 2013

I am trying to make an add-on to IE. This add-on doesn't have any tool bar or any UI.

I am just taking the details of currently loaded HTML page. Basically it is for manipulating one dialog box. I want to get access to the DOM COM interfaces of the dialog box.

Since it doesn't have any button I didn't impliment IOleCommandTarget. I implemented only IObjectWithSIte.

My RGS file contain following in addition to my COM related entries

HKLM
{
NoRemove SOFTWARE
{
NoRemove Microsoft
{

[Code]...

But I couldn't see my add-on working or even not loading to IE.

View 4 Replies View Related

Visual C++ :: Can Only Make Video With 255 Frames

May 4, 2015

I have code (found long time ago, ~2001) to make videos from OpenGL rendering in my view class. In my OnDraw() function I call the function SaveAsAvi(). This works as intended until I have 255 frames in the movie I am trying to make. After that, Windows Media Player claims it cannot play the file. VirtualDub claims the avi contains Palette Changes and shows the correct number of frames (>255) but all frames past 255 are the same and equal to the last frame.

Memory overflow? Need to free m_pixels sometime somewhere?

Code:
void C***View::SaveAsAvi() {
C***Doc* pDoc = GetDocument();
if (pDoc->m_avi_status == -1)// initialize AVI stuff {
KillTimer(1);
// allocate space for the pixel info

[Code] ....

View 1 Replies View Related

C++ :: Make Visual Studios Step Into A Function?

May 2, 2013

if there is a way to make Visual Studios step into a function while I am debugging.. I am trying to see the value of a certain int and making sure it is what I need it to be.. but whenever I use step into visual studios just skips right over the function and it does all the calculations..

View 4 Replies View Related

Visual C++ :: How To Make Icon For MSVC Project

Oct 22, 2013

I'm developing a software for Windows using MSVC 2010. My employer sent me 2 png files: 16x16 and 32x32 for the icons.

What I would like to do is to use them as a MSVC icon resource and don't use any code hacks. In the past all I had was an ico file and I just included it in the resource (rc) file for Visual Studio and that was it.

Now my question is: how do I make one ico file out of those 2 png files that will be accepted by MSVC? Is there a tool (preferably free) for it or some online service?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved