Why can't I compile/run this non-CLR program in VC++ 2008?
How to do it?
MyProgram.cpp
#include <iostream>
namespace System
{
public class Console
{
public:
static void WriteLine(char str[])
{
std::cout<<str;
}
};
}
int main()
{
System::Console::WriteLine("This a non-CLR p...
I want to transform a vector of type T to a vectorof type K.
I tried this, but it doesn't work:
transform(vec.rbegin(),vec.rend(),vecNew.begin(),boost::bind(static_cast<K>(),_1));
I get the error: "expected primary-expression before ‘)’ token". What am I doing wrong?
...
Okay so I have the following makefile
CC = g++
#CFLAGS = -g -Wall
CFLAGS = -g
LDFLAGS = -lm
#client : shared.lib
#server : shared.lib
shared : src/shared/opcode.h
$(CC) $(CFLAGS) -I./src/ -I./lib/boost/ -L./lib/boost/stage/lib/ -L./lib/win_sdk/ \
-D_WIN32_WINNT=0x0501 \
-lWS2_32 \
-lboost_system-mgw34-mt-1_43 \
-lboos...
i have program which prints all char from char_min to char_max here is code
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
char c;
c=CHAR_MIN;
while(c!=CHAR_MAX){
printf("d\n",c);
c=c+1;
}
return 0;
}
but it prints only all d why?ouput is like this
d
d
d
d
d
d
d...
hi,
I saw an example of using the function: delete in cpp and I didn't completely understand it.
the code is:
class Name {
const char* s;
//...
};
class Table {
Name* p;
size_t sz;
public:
Table(size_t s = 15){p = new Name[sz = s]; }
~Table { delete[] p; }
};
what is the exact action of the command: de...
Hi, I think this is an easy question, sorry I am not really familiar with C++.
I am using D3DImage in C++.Net project which is using it's SetBackBuffer method, and I am also using DX Surface. I don't know how to convert IDirect3DSurface9 to IntPtr as parameter in SetBackBuffer method. Anyone knows? please help.
...
I'm making a memory patcher for a game but when compiling it with only a single patch implemented, no vtable was created (Using mingw). Could someone tell me what is the problem and how I can fix it?
a_patch.cpp (Compile this)
#include "a_patch.h"
void a_patch::init_patch()
{
/* example initilisation */
init_var();
vector...
Hi,
declaring a struct Table:
struct Tables {
int i;
int vi[10];
Table t1;
Table vt[10];
};
Tables tt;
assuming that a user-deault contructor is defined for Table.
here tt.t1 will be initialized using the default contructor for Table, as well as each element in tt.vt.
On the other hand tt.i and tt.vi are...
Specifically for sending commands and receiving sensor data.
...
hi,
what are the requirement for a function so it could be executed inline in c++?
is there a case that a function can't be inline?
or any function can be inline and it is the responsibility of the programmer to decide how to define the function, based on run time and compilation-time considerations?
...
Suppose we've got two integer and character variables:
int adad=12345;
char character;
Assuming we're discussing a platform in which, length of an integer variable is longer than or equal to three bytes, I want to access third byte of this integer and put it in the character variable, with that said I'd write it like this:
character=...
Hi,
I have a class where I use this to initialize a void* pointer. But the problem is, when I pass an instance of that class by value, the pointer will not change to the new address on the stack. So, I thought to override the copy constructor to reassign the pointer with the new address of this. But I need variables to call the super-cl...
#include<iostream>
int& f(){
static int x = 0;
x++;
return x;
}
int main(){
f() += 1; //A
f() = f() + 1; //B
std::cout << f();
}
The above code outputs 6 on gcc and 5 on MSVC. Now when I modify A and B to f()=f() I get 5 on both compilers. What is the big deal here? Is the behavior undefined. If yes , why?
...
I come from a .NET background and will be going into the field of rendering / graphics using OpenGL/DirectX. For this purpose C++ will be my language of choice to interact with these rendering frameworks.
As I understand it Visual C++ allows native support for CLI which is an extension to C++ that allows the application to benefit from ...
I have hot this error at the linker:
LINK : fatal error LNK1104: cannot
open file 'libcollada14dom21.lib'
I dunno why, libcollada14dom21.lib is in VSDIR/VC/lib.
...
Lets say I have a C++ program and I want to call functions from a C object file in it. The constraint is that I'm not allowed to make any changes to the C source files.
In this case I would include the C header as extern "C" in my C++ file, call the function, compile the C object using gcc -c, and pass the result to g++ along with the a...
Hello, I can't understand why does vector empty after it's filling.
The code is:
bool fillArray (vector<int> &array)
{
string temp;
getline(cin, temp);
if (temp == "-1")
return false
else
return true;
int res = atoi(temp.c_str());
array.push_back(res);
}
void showArray(const vector<int>...
Hi,
I read that for user-defined types, postponing the defintion of a variable until a suitable initializer is available can lead to better performance.
why?
...
Hello,
I am looking for a C++ framework that can synthesise audio and also has the ability to analyse audio input for its frequencies. What I am trying to do is create a digital transmission algorithm that can transmit data and text via audio.
It should be possible to create an audiostream with different frequencies and phasing at one ...
I have a video feed which is taken with a moving camera and contains moving objects. I would like to stabilize the video, so that all stationary objects will remain stationary in the video feed. How can I do this with OpenCV?
ie. For example, if I have two images prev_frame and next_frame, how do I transform next_frame so the video came...