Okay I have updated my code a little, but I am still not exactly sure how to use the vector of command line arguments that I pass. I tried to set it up like the code I have below, but it wont compile. It gives me the error that it cannot find argc and argv:
1>c:\users\chris\documents\visual studio 2008\projects\cplusplustwo\cplusplustwo...
Can anyone suggest good Gauge controls to use in application using C++.
The Gauges will be used in application monitoring Temperature, Pressure or Flow devices.
Please let me know about any commercial or free libraries that works on pure C++, without any dependency on .Net framework
Thanks,
...
I have a cd , dvd. book media program. Currently, i am trying to add book information to a set. I am getting a nasty crash.
error: Unhandled exception at 0x00449d76 in a04xc.exe: 0xC0000005: Access violation reading location 0x00000014.
So, obviously its trying to access memory its not suppose to? just not sure why or what i need to d...
Hi, guys,
My dev environment is VS2008, DX9, Windows XP.
I try to add protection handling to the out of memory case.
When malloc return NULL, I would page some resource to disk, and release the resources in the memory.
But sometimes, malloc always return NULL, even if I release most of resources and process memory usage and VM size is o...
Hi,
I have an application for which GUI is written in C# and the logic is written in C++ DLL. The DLL should open a file to read data from it. I have the data.txt file in the same folder as the DLL. When I call
fopen("data.txt","r")
the value returned is NULL. What could be the problem? Please help me in this regard.
Thanks,
Rakesh.
...
I want to move certain element from a to b:
boost::ptr_vector<Foo> a, b;
// ...
b.push_back(a.release(a.begin() + i)));
The above code does not compile because the release function returns boost::ptr_container_detail::static_move_ptr<...>, which is not suitable for pushing back.
How should I proceed?
EDIT: I found out that the objec...
Hello,
Question
Following code fails with a error message :
t.cpp: In function `void test()':
t.cpp:35: error: expected primary-expression before '>' token
t.cpp:35: error: expected primary-expression before ')' token
Now I don't see any issues with the code and it compiles with gcc-4.x and MSVC 2005 but not with gcc-3.4 (which is s...
Hi everyone,
I have a friend who's taking over a Visual C++ project from me and is having trouble running it. It's a graphics application and it uses the Qt GUI library. The reason I mention this is because of the error below.
He can build and link the program using Visual Studio 2010, but when he runs it this message comes up in the ...
Hello, i'm really new to C++-programming and i've got an a problem with writing into a xml document.
I'm using a slightly changed example of xml outputter from msdn (http://msdn.microsoft.com/en-us/library/ms766497(VS.85).aspx).
HRESULT CreateAndAddTestMethodNode(string name)
{
HRESULT hr = S_OK;
IXMLDOMElement* pElement = NULL;
CHK_...
This is my test.cpp:
#include <iostream.h>
class C {
public:
C();
~C();
};
int main()
{
C obj;
return 0;
}
When I compile it using the command g++ test.cpp, I get this error message:
In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
from test.cpp:1:
/usr/lib/gcc...
Hello all,
I'm looking for a method or a way to generate a list of typedefs and a list of object instantiations from a list of macro-invocations, defining the class types and the constructor parameters of these objects.
It should look like the (not working) code below. The problem to solve is a way to generate to different lists out of...
In my C++ library I have a type boost::variant<A,B> and lots of algorithms getting this type as an input. Instead of member functions I have global functions on this type, like void f( boost::variant<A,B>& var ). I know that this can also be achieved with templates, but this is not suitable for my design.
I am very fine with this style ...
I am wondering if there is any benefit to getting a reference to a vector prior to calling
BOOST_FOREACH or whether a method call which returns a reference will be automatically used? For example which of the two following loops will be equivalent to the third loop?
vector<float>& my_method();
void main()
{
// LOOP 1 -------------...
Hi all,
My application uses an int as id to identify objects in both in-memory and persistent registry. Functions in the application receive the id as argument, retrieve the object from the registry and do their job, e.g.
void print( int id, int bar, double zip, int boo )
{
Object *obj = get_obj_by_id( id );
obj->print( bar, z...
Hello,
I want to use an 3rd party library without using its header file. My code resides in its own namespace, therefore I can't use conventional forward declaration as I don't want to pollute the global namespace. Currently I have something like that:
3rd-party-library.h----
typedef struct {...} LibData;
void lib_func (LibData *);
m...
How does a pointer points to [-1]th index of the array produce legal output everytime. What is actually happening in the pointer assignment?
#include<stdio.h>
int main()
{
int realarray[10];
int *array = &realarray[-1];
printf("%p\n", (void *)array);
return 0;
}
Code output:
manav@workstation:~/knr$ g...
Hi,
I want to print messages onto the console screen from a C++ DLL. The front end for this application is in C#. I used AllocConsole() fundtion to create a console from the C++ DLL. The window is being created but no messages were being printed when I try to print a message. Please help me fix this problem.
Thanks,
Rakesh.
...
Hello,
I want to save my custom DockWidgets (inherited from QDockWidget) with the saveState() / restoreState() function my MainWindow provides.
I have two questions:
1. How can I save and restore my Dockwidgets?
- I already tried registering my custom DockWidgets as a QMetaType and implementing the default Constructor, copy Construct...
Hello, I don't know why but today myOpenID doesn't seem to work. Anyway ... I have this problem: I have a unmanaged C++ library (DLL) which I have to embed in an existing C# project. Now ... I have created a mini-wrapper (DLL) in managed C++ which calls the library so that I can load it from the C# code and, when I try it from a command-...
Why does the following output 1?
#include <iostream>
class Test
{
};
int main()
{
std::cout << sizeof(Test);
return 0;
}
...