C++ :: How To Exchange Big Structures Across Libraries
Nov 6, 2014
I have written library in c++ for c++ application. Here, data exchange between library and client through structure. This structure has 20 members ( strings, integers, reals, pointers).
In some flows, library needs few members should get filled in the structure. for ex, application filled 3 integers information and passed to structure. But, in memory, whole structure is occupied.
I think, If library provides functions for every combination, then it would end up with lot of functions. I want to avoid that.
How to optimize data exchange between client and library? ( number of members may be filled sometimes 1, 2, 3, .. 20)
View 7 Replies
ADVERTISEMENT
Sep 29, 2013
I need exchange strings in field, but how to do that. For example:
{"Hi", "Hello", "Goodbye", "Morning"};
to
{"Hello", "Hi", "Goodbye", "Morning"};
I tried this, but it isn't working:
Code:
for(unsigned int k=0; k<slova[i].size();k++){
t = slova[i][k];
slova[i][k] = slova[i+1][k];
slova[i+1][k] = t;
}
View 7 Replies
View Related
Mar 15, 2012
#include "vehicle.h"
...
void exchange(vehicle *&v1, vehicle *&v2) {
vehicle *tmp = v2;
v2=v1;
v1=tmp;
}
Is it right?
How about: void exchange(vehicle *v1, vehicle *v2){...}
What is the difference between *&v1 and *v1 ?
View 4 Replies
View Related
Jan 19, 2014
I am trying to iterate a matrix in order to exchange rows and columns element by element. Although the function that exchanges the rows has come out well, i don't seem to figure out how to do the same on columns.The columns switch for a matrix like
1 2 3
1 2 3
1 2 3
if i try to switch column 3 and 2,is:
1 3 2
1 3 2
1 2 3
Here are both of the functions:
void interchange_rows(int *p,int n,int r1,int r2){
int temp;
for(int i=0;i<n;i++){
temp=*(p+r1*n+i);
*(p+r1*n+i)=*(p+r2*n+i);
*(p+r2*n+i)=temp;
[Code] ......
View 1 Replies
View Related
Apr 8, 2014
Base class has an array, whose size is controlled by the derived class.
I can't use the STL and use a 2003 compiler, so things like std::vector and std::array are out. I also can't use dynamic memory allocation.
So I thought of a few options:
1.
template <int N> class myBaseClass { ... int array[N]; ... }
then class MyClass: public myBaseClass<8> ... etc ...
2.
have a int **array in the base and assign in the derived class.
3.
give the base some virtual methods such as int *getArray or even int &getInt for more safety.
View 6 Replies
View Related
Feb 5, 2013
I'd like to use the Big Integer Library [URL], but I have issues to use it. I'm using Xcode as compiler and I don't know how to include the library in my project files. When I drag all the files in the project directory and write the statement #include <BigInteger.hh> on the top of the declaration of the main function, even whiteout any other code, I get lots of build error on the .hh and .cc file.
how to include the library on my project.
View 1 Replies
View Related
Mar 5, 2013
I have an issue getting boost libraries to work with QT IDE. Here are relevant lines from my .pro file...
INCLUDEPATH += c:/users/bob/desktop/boost_1_53_0/
LIBS += -LC:c:/users/bob/desktop/boost_1_53_0/stage/lib64
After adding #include <boost/filesystem.hpp> I get error...
C:UsersobDesktopqtpuntitled5mainwindow.cpp:3: error: C1083: Cannot open include file: 'boost/filesystem.hpp': No such file or directory
The IDE does not highlight the line. The error only appears on compilation.
View 2 Replies
View Related
Oct 1, 2013
i have written an algorithm in VC++ 2010 express edition. i have used the following header files
#include<iostream>
#include<string>
#include<sstream>
#include<ctime>
#include<cassert>
#include<fstream>
#include<vector>
[Code]...
the algorithm worked fine in vc 2010 express edition....
the following header files are not working in vc5
#include<regex>
#include<tuple>
#include<numeric>
#include<unordered_set>
#include "clip.h"
Looks like some of hte boost libraries have to added with vc5.. If any one knows how to add boost libraries with vc5.
showing lot of errors in vc5... not able to run the algorithm in vc5. Our company has only vc5.... the algorithm has to be implemented in vc 2010....
View 2 Replies
View Related
Dec 22, 2013
Is there any way to do date math using standard C libraries? I looked around in the time.h but didn't see what I needed.
What I need to do is be able to add a certain number of minutes to a date and have it give the current date/time. For example, add 15918765 minutes to 01/01/1980 00:00 and have it tell me 04/07/2010 4:45PM. I really don't want to write this myself or go platform-specific.
Does this exist somewhere or am I SOL?
View 13 Replies
View Related
Dec 30, 2013
I know I can use -isystem path to mark a path as containing system headers which shouldn't be included when generating warnings, and this works, but it doesn't work when the warnings are generated by instantiating templates from the library in my source code. Is there any way to ignore these template-instantiation-generated warnings too?
View 13 Replies
View Related
Aug 26, 2013
I'm trying to create a GUI with Open graphics Libraries.I have made a basic GUI that exits the program or shows the instructions if a option/Polygon is marked (A bigger one is behind them)But what I'm trying to do now is the following:
0. Start the direct access on the desktop
1. Screen: Press any key to continue
2. Select one option
2.1 Option one: Go to the circuit selection menu
2.1 Option two: View the instructions (Cleared)
2.1 Option three: Exit the game (Cleared)
3. Select a circuit
4. Go to the car selection menu
5. Select a car and start the race
6. Pause menu if Spacebar has been pressed
From the pause menu:
6.1. Go to the main menu
6.2. Restart the race
6.3. Exit
I know that it is OpenGL, but what i'm looking for is C++.How I could do that? What I have cleared is with IF but I'm looking for better alternatives.
View 1 Replies
View Related
Apr 30, 2014
There are many libraries in C++, but how are they made?
For example: SDL, SFML, Open CV, STK
There are no special functions in C++ from which we can create such libraries, If I wanted to create a library that processes sound signals, how would I do that? How can I access the mic, speakers and process the signals.
Open CV processes videos but which functions does it use?
View 3 Replies
View Related
Aug 1, 2014
I want to write a small game library that uses GLFW.
So I have for example a window class that uses GLFW functions.
To do that my window class must include the GLFW header files.But I don't want, that if I use my library later and I include my window class, that all GLFW functions are included, too.
How I can prevent this and hide GLFW from users of this library completely, so they theoretical don't notice that this library use GLFW ?
And a second question, is it possible, if I export my game library statically that the GLFW lib files are hidden in my own lib files, so that I have finally only one lib file that is needed to use my library ?
View 4 Replies
View Related
Mar 4, 2013
I've worked a lot in Java and Perl and now I'm learning C++ and working on a simple e-reader (let's not get into why I'm not just using Kindle or other existing ones). This is for me and a number of friends.
At first my project will be on OS X, then Windows and Linux, and I hope to eventually use it on Android and iOS. I know that the last two will require separate GUIs, but I'm hoping the rest of the code will port easily.
Here's the problem:
I'm using Poppler to read and display PDF files. I started installing it on my iMac and it needs FontConfig, which is turning out to be a difficult install. I would not want to walk others through this or make them have to install Poppler and FontConfig (and any other libraries I find both need).
I thought I could just compile my final binaries using "-static" but I've been reading about how some libraries can't be statically linked or compiled.
Also, since I want to eventually port this to 4 other OSes (and apparently Poppler can work on those target OSes), I don't want to do something now or depend on something that will make it hard or impossible to port to other OSes later.
With that in mind, here are my questions:
1) Why is it some libraries cannot be compiled statically? How do I know if I'm dealing with one of those libraries?
2) Am I right that I could compile this program statically, and the resulting binary would include code from Poppler and FontConfig and other libraries would be included in the resulting executable binary?
3) What do I need to watch for so I can tell if using a particular library will be a problem when I need to port my program to a new OS? (Assuming, of course, that searching shows that library will compile or has been ported to that OS.)
View 7 Replies
View Related
Aug 18, 2014
I want to know:
1. Pros and cons of shared libraries
2. How to create them(any tutorial link or book will be good)
3. Compare static libraries to dynamic ones
View 1 Replies
View Related
Mar 6, 2013
I have been trying to compile a static version of the boost libraries, however when I try to launch the program it says fatal error LNK1104: cannot open file 'libboost_serialization-vc100-mt-s-1_53.lib'
I have checked in the boost/stage/lib folder and that file is not there. I compiled boost with b2 link=static yet the file still isn't there.
View 3 Replies
View Related
Jul 28, 2014
I tried to add a .a file to the list of link libraries, but when I build, I'm confronted with the following;
ld.exe||<the path>: Permission denied
I'm an admin on this machine - What?
View 14 Replies
View Related
Aug 1, 2013
The brief is to write a program that implements a musically-interesting or musically-useful audio effect/process in C without external libraries other than those prescribed (PortMedia/PortMIDI/PortSMF/PortAudio, Libsndfile).
View 6 Replies
View Related
Apr 10, 2014
I've finished my series of tutorials and built a investment calculator with QT, now that's finished and I wanted to create a small radio that allows to retrieve audio from an URL. I wanted to use Juce but I'm clueless about it, I know how to program but I've never touched external libraries?
View 2 Replies
View Related
Dec 24, 2014
I'm currently working on a Microsoft (unmanaged) C++ project which utilizes Boost C++ libraries. It's been quite a while since I've done C++ and I have no previous experience using the Boost libraries.
We are using Boost 1.55 and MSVC 2013. We used CMake to generate the Visual Studio solutions and projects based on the original project layout.
We've successfully built and tested on other environments. In the MSVC - Windows environment, we've run into issues using Boost's Property Tree support. Specifically, the issue seem to center around trying to put properties into PTNodes.
Consider the following code snippet:
void XXX:: SomeFunction() {
PTnode ptNode;
ptNode(Mapper::KEY_INPUT, Tracer::SOME_VALUE);
ptNode(Mapper::KEY_OUTPUT)(Tracer::SOME_OTHER_VALUE, Tracer::ADDITIONAL_VALUE);
SetResults(ptNode);
[Code] ....
This work around seems insert the nodes successfully into the tree.
We are able to verify by finding the inserted items in ::SetResult().
Why this might be failing in VisualStudio C++?
Is this an issue of compiler flags?
precompiler definitions?
Linker options??
Memory mode/model??
Are there some basic behaviour differences in MSVC C++ and other C++ environments which we are unaware of?
I've tried to identify all instances of the node insert pattern and use the work around. But, we really need to find out what the issue is (as there could be other manifestations).
View 1 Replies
View Related
Jul 21, 2013
Ok, for my Sunday homework I have to find the next day of the year using structures. Now, I can get the structure to read the entered date (tested that with a simple scanf to printf entered data), but I need to get it to be able to tell that it is the end of the month and print out the next month when necessary. Here is what I got so far:
Code:
//Cameron Taylor
#include <stdio.h>
struct Date{
int month;
int day;
int year;
[Code] ....
As you can see, I am trying to use an array for the max day of each month (excluding Leap Year for now).
Where I use the entered month to = 'i'. Then I use 'i' as the position in the array to see if next.day is = to the max day of that position of the array.
I am having no compiler issues with GCC using -w or -Wall, but after entering the current day the program stops working and doesn't go beyond the input.
commiedic@localhost Project18$ gcc -o -Wall Exercise4.c
commiedic@localhost Project18$ gcc -o -w Exercise4.c
commiedic@localhost Project18$ gcc -w Exercise4.c
commiedic@localhost Project18$ make Exercise4
make: `Exercise4' is up to date.
[Code] .....
View 13 Replies
View Related
Apr 5, 2013
I have to do a project for Programming and he said in quotes
"Programming exercise 10.6: the programming project is as described, except do not represent the points using structures.
Assume, as known, the ten (x,y)-values corresponding to x=0.0, 0.1, 0.3, 0.45 ..etc and use y-values from the
function xsin(x); as in (x,y)=(x, xsin(x)) = (0.3, 0.3sin(0.3)).
Use value n+1=10, so the LaGrange polynomial will be order = 9."
What does it mean to not represent the points using structures??
View 2 Replies
View Related
Jun 23, 2013
How to print out these structures using loops.. printing out these outputs using loops..
View 5 Replies
View Related
Nov 26, 2013
A user is supposed to enter student name, id, and grade then sort them by name, id, or grade. I managed to get it to sort by name and id correctly, but not by grade.
Code] .....
#include <string.h>
#include <stdio.h>
struct student{
int student_id;
char name[30];
char grade[15];
[Code] ....
View 8 Replies
View Related
Aug 9, 2013
How do I store pointers to a struct in an array ? I am using sprintf to concatenate some values together and then output it to an array in its 1st argument. A portion of my code is shown below.
Code:
int count = 0;
struct addx {
int a;
[Code].....
View 1 Replies
View Related
Feb 26, 2014
I am bit confused in passing the structure to a function. I made a small code and it doesn't build !
Code:
#include<stdio.h>
struct Compute_off_Time(struct WHATTIME);
typedef union _Time {
unsigned long int Value;
[Code] ....
View 1 Replies
View Related