C++ :: How To Make Protobuf Dependent Lib Available In Non-protobuf Environment

Jul 11, 2013

I have a C++ project depending on protobuf, but there's no guarantee that all users have protobuf installed on there own PC(protobuf is only not the only way of serialization) but they also want to use the project as a lib. In that case, dynamic linking to protobuf while compiling the project is not a choise(the project.so will dynamicly depending on libprotobuf.so) what can I do?

View 3 Replies


ADVERTISEMENT

C++ :: How To Make Derived Dependent Of Base In One File

Feb 10, 2014

I have a class Base (abstract, with pure virtual) and Derived (which inherit Base). I use this:

Base* A = new Derived();

But I can do this:

Derived A;

How make Derived dependent of Base in one file?

View 4 Replies View Related

Visual C++ :: How To Convert MFC Dependent Source To Non-MFC

Feb 25, 2013

IDE = Visual Studio 2008 Express

I am a novice programmer(still...) , and I am trying to build the Code Project project located at this address:

[URL] .....

The project page is titled " Remote Control PCs ".

I would like to use this program plus I wanted to practice programming using the code base. However, I don't have MFC so I thought I would just convert it to non-MFC.

For example, It seems to me that any class inherited from MFC would need to be reimplemented. I think I also need to reimplement any code that uses "stdafx.h"

I built a custom project out of the zlib library and compiled it as a Windows library with the /MT settings. Both 32 and 64 bit library files, in Release and Debug mode, are included. The ZLIB.H and ZCONF.H files are also included. For examples of single-threaded usage, see the CZLib class. For examples of multi-threaded usage, see the classes CDriveMultiThreadedCompression, CMultiThreadedCompression, and CZLib.

1)How should I go about compiling this zlib custom project?

2)Where does the /MT option go ?

3)How do I use the output ( zlib.lib - I guess)?

View 9 Replies View Related

C++ :: Function Matching And Argument-dependent Lookup

Aug 8, 2014

#include <iostream>
#include <string>
std::ostream& operator<<(std::ostream& os, const std::string& str) {
os << '[';

[Code].....

In the above program, I define an operator<< function in global namespace which has exactly the same signature as the one define in <string> header : [URL] . In the main function, I call operator<< on cout and a string, after which I guess it would cause ambiguity. The result is out of my anticipation, it compiles and prints [hi]. So I guess my function is a better match because it does not require argument-dependent lookup (ADL). Moreover, even if I add using namespace std; at the beginning of the main function, the program still compiles and prints [hi].

In short, I have two question:

#1 : Why is my function a better match (therefore no ambiguity) in the two cases respectively (with and without using namespace std;)?

#2 : Does using namespace affect ADL? Is ADL still performed after applying using namespace, or is it not performed because the function is thrown into global namespace?

View 3 Replies View Related

C++ :: Debug Multithreaded Application In Unix Environment?

Mar 3, 2013

How can we debug the multithreaded application in unix environment?

View 1 Replies View Related

C++ :: Handle Exception In Multi-threaded Environment

Oct 24, 2014

Here is the code,

Code:
void foo() {
Acquiring lock
do something...
Func();
Releasing Lock
}

If the function Func throws an exception, there is potential deadlock issue. Then I handle exception like this,

Code:
void foo() {
Acquiring lock
do something...
try{
Func();

[Code] ....

Is this a good practice? I wonder how I can apply RAII in handling exception here.

View 2 Replies View Related

C :: Program To Recognize Pattern Of Signals (linux Environment)

Mar 6, 2015

I need to write a c program that can receive signals and recognize a certain pattern (SIGUSR1, SIGUSR2, SIGUSR1, SIGUSR2). once the pattern is caught the program terminates itself.

I am able to send the signals to the program from a different process, but I am unsure on how to get the signal handler to recognize the pattern. here is what i have so far:

Code:
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
sig_atomic_t sigusr1_count = 0;
sig_atomic_t sigusr2_count = 0;

[Code] .....

I just need getting the program to be able to catch that specific pattern.

View 4 Replies View Related

C :: Language Program Environment Does Nothing To Prevent Buffer Overflows

Sep 25, 2013

TheC language program environment does nothing to prevent buffer overflows ..... is there any pros to the obvious cons of this?

View 3 Replies View Related

Visual C++ :: Floating CDialogbar On Multiple Screen Environment

Jul 11, 2014

I have an problem with a CDialogbar if my app runs on a system with two screens (side by side). I can not resize it while the CDialogbar is in floating state on the second screen.

I figured out that the problem is the mfc-function CDockContext::Stretch().

It limits the CDialogbar to the primary screen (using ::GetDesktopWindow() to verify the position).

What can I do?

View 2 Replies View Related

Visual C++ :: Dragging And Dropping Functionality In Windows 8 Environment

Jul 14, 2014

i have developed an application in which i have icons in left side pane of application which can be dragged and dropped in client screen. Application is working fine with all the resolution except 1920x1080.

when setting the resolution to 1920x1080 while dragging icons to client area, icon is not attach to mouse pointer. instead there is a gap between the mouse pointer and the icon. i wrote code to identify the screen resolution but it does not seem to recognize 1920x1080 resolution. below code is giving incorrect resolution for 1920x1080 setting.

RECT actualDesktop;
GetClientRect(GetDesktopWindow(),&actualDesktop);

value of 'actualDesktop' variable is {top=0 bottom=783 left=0 right=1536} which is incorrect. according to current resolution size value should be {top=0 bottom=1080 left=0 right=1920}. Due to this, all the icons while dragging are adjusting according to incorrect resolution setting.

how to identify the issue and if there is any limitation with respect to screen resolution in VC++ 6.0 with windows 8 environment.

I am getting same issue when compiling in VS2012 in windows 8. Code does not seem to recognize 1920x1080 resolution setting and downgrading my application look and feel by setting it to lower resolution.

View 1 Replies View Related

Visual C++ :: Static Class Member In Multithreaded Environment

Nov 21, 2014

I have a class having static member.I have get and set methods which will Get and Set Values to this variable. In a multithreaded application does it have any thread safety issues.

Class a {
static int b;
void Set (int c);
int Get();
};

View 10 Replies View Related

C :: How To Make Sum Columns

Oct 17, 2013

I have this code it sums the rows now I need it so it would sum all the columns in the output and put it in row 8 of the outcome. How would I go about doing that?

Code:

#include Code: "stdio.h"
#include "stdafx.h"
int main(void) {
int number[8][7];
}

[code]....

View 1 Replies View Related

C :: How To Make 918 Print As 18

Aug 27, 2014

i am using turbo c++ my program is based on maths equations and my final answer is 918 or any 3 digit number only but i don't want 918 to print instead i want only 18 to print. this program gives different output for every different input so i can't just minus 900 from it and get 18. i just want that no matter what 3 digit number is the answer,i just get the 2nd and 3rd digits while printing it and not the first.

the final answer giving equation is:-
f=2914-1996
where f is my answer and its 918
but i want it to print as 18 not 918

View 1 Replies View Related

C++ :: How To Make A Window Always On Top

May 11, 2013

I want to make a window tgat stays always on top like that of a cybercafe software. A window that cannot be closed, minimised, deactivated, etc... with wxWidgets.

So far I've tried making a frame window with the wxSTAY_ON_TOP flag. It works, but not to perfection because, when i press the windows button, the start menu interferes with the window(and taskbar too). Also, the task manager, how to deactivate it.

- a wjndow that strictly stays on top

- deactivate task manager

View 3 Replies View Related

C/C++ :: Make A Window?

Oct 15, 2014

how to make a window in C++? I am trying to make a program that has a boot screen but I want it to be in its own window because it will have it's own pictures in it and text inside too. So not in a terminal but inside a external window.

View 1 Replies View Related

C++ :: How To Make A Simple Program EXE

Feb 12, 2014

I would like to know how can I make a simple program .exe so that I don't have to open it through code blocks every time.

View 2 Replies View Related

C++ :: How To Make Dll And Lib Using G++ Command Prompt

Mar 6, 2015

1. What is dll and lib?

2. How do I make dll and lib using g++ command prompt?

Also, how do I link libraries using g++?

Any good websites that covers my questions,

View 1 Replies View Related

C++ :: How To Make A Template That Has 2 Stacks

Jan 11, 2015

How do I make a Template that has 2 stacks ?

Code:

template <class T>
class A {
};
template <class T>
class B {
};

is this code correct ?

View 1 Replies View Related

C :: How To Make A Char Counter

Apr 14, 2013

One that fills different char arrays the idea is to use a single char to represent a char such as 255 but if more than it then use a char array of two chars to represent the next char 00 because if only one is needed it would take less disk space than 0,255 as it would in an array.

My goal is to do this all the way up to an array that can hold 255,255,255,255 but only use the more complex array if needed Example: a char of 255 takes much less space than a char array of 4 chars so that instead of 0,0,0,255 it is written to disk as a single char whereas a char array of 200,0,0,1 would be written as a 4 byte char array. use single char to represent values from 0 to 255 use two char array to represent 0,1 to 255,255 three for 0,0,1 to 255,255,255 and four for 0,0,0,1 to 255,255,255,255

View 3 Replies View Related

C :: How To Make Exam Schedule

Mar 5, 2013

i want to make a exam schedule with C or C++ language,but I do not know how to do it,which algorithm do i use?

View 6 Replies View Related

C :: How To Make A Sort Function

Feb 28, 2013

Im suppose to make a "poor mans" variation to the Sort function built into unix. The program is suppose to read in a file and sort the contents of the file. So its a variation of the Unix Sort feature. I have remade the readLine function we were provided so that it doesnt use fgets. where to go from here, Not sure on how to make a sort function. Here are the reqirements of the program:

Code:

• Re-implement the readLine() function so that it no longer makes use of fgets(). Instead,
process the input on a given line character-by-character.

• Provide code which will create a data structure similar to argv to hold all of the words to be sorted. Use malloc() to ensure that each entry has just the required number of bytes needed to store the words. The final entry in your array should be the NULL pointer.

• Implement a sort() function which will rearrange the words in sorted order. To swap two words in your array, note that only a pair of pointers need to move. The strings themselves, once established, will never move. Heres what i have:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LINES 1000 /* maximum number of reminders */
#define WORD_LENGTH 10 /* max length of reminder message */

[code]....

View 9 Replies View Related

C :: Trying To Make A Stack Through Malloc

Oct 27, 2013

I am curious as to what is happening to my pointers and everything once I call malloc to create space for 5 integers to try to make a stack.

Code:

#include <stdio.h>
#include <stdlib.h>
void add(int * TOP, int * stack);
int main() {
int *stack = NULL;
int *TOP = NULL;
stack = (int *)malloc (5 * sizeof(int));

[Code] ....

I am guessing that when I initialize stack to malloc, stack now stores the starting address of where the space is taken out, and also assigns TOP that address too. I get the choice from the user (b) to get the instruction to try to push on the stack. I was told that the if statement in the function checks if the stack has passed the bounds of 5 elements. If not, it assigns the scanned variable and puts it into what TOP is pointing to and increments TOP to the next address. It is not working and am wanting to see where my logic is wrong.

View 4 Replies View Related

C :: Make A Separate Function

May 6, 2013

I will post the entire code at the bottom. Its running fine right now but This part in the menu function I need to make as a separate function. My problem is when I make it into a function by itself I have to declare and initialize the grades A,B,C,D,F how can I do that when I can't make them equal 0 because it has to keep track of how many of each letter grade.

Code:

//Count letter grade
if(ave >= 90)
++A;
else if (ave >= 80)
++B;
else if (ave >= 70)
++C;
else if (ave >= 60)
++D;
}

[code]....

View 3 Replies View Related

C :: How To Make Nested Loops

Dec 7, 2013

Howi can made nested loops?

Code:

for (yax=0; yax<10; yax=yax+1) {
for (xax=0; xax<100; xax=xax+1) {
printf("%d
",yax);
}
}

way what i tired dont work. or maybe works but why this prints only zeros ?

View 8 Replies View Related

C :: Make A Program Using While Or For Loop?

Nov 20, 2014

I'm trying to write a program for a lab, I know how easy it is but cant see to crack it.

I need to make a program using while or for loop.

I must have the user type a number, for an input value an output value but then do it again several times but without it going on forever asking again and again.

View 4 Replies View Related

C++ :: How To Make Game Available To Be Played On LAN

Jul 1, 2014

I'm making a simple single-player game. Now, assume I've made the game, how would I go about making it available to play on LAN? (I'm not really bothered about making it playable across the world with people not on the same wi-fi)

So, any way that I could get started or any libraries/APIs ....

I'm using Windows 8.1 and I'd like my game to be playable on other Windows OSs (7 and Vista if possible)

View 3 Replies View Related







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