создал мэйк файл с помощью утилиты autotools. все получилось кроме настройки make install.
дополнительные папки с конфигами и картинками.
install-data-local. Как используя адрес переменной полученный из первый программы изменить значение самой переменной?
DWORD ProcessId = ...;
LPVOID Address = ...;
int value = 500;
processHandle = OpenProcess(PROCESS_VM_WRITE, FALSE, ProccessId);
if (WriteProcessMemory(processHandle, Address, &newValue, sizeof(newValue), NULL))
printf("Success\n");
else
printf("Error\n");volatile int value = 100;, чтобы она гарантированно извлекала значение переменной из памяти на каждой итерации цикла. После сборки чужой библиотеки из исходного кода, появился файл с расширением .lib
Что делать с ним - непонятно,
windres lib/glut/glut.rc lib/glut/resources.o : Invalid argumentresources.o
в чем может быть дело
windres lib\glut\glut.rc lib\glut\resources.oПодскажите пожалуйста, почему так
a b c символы, которые нужны библиотеке b будут искаться только в библиотеке c, но не в a. Если между библиотеками нет циклических зависимостей (т.е. нет такого, что a определяет символ, нужный b, а b определяет символ, нужный a), то их можно упорядочить так, что линковка будет успешной (см. топологическая сортировка). Если циклические зависимости есть, или сортировать лень, можно перечислить нужные библиотеки несколько раз или взять их в группу:g++ main.cpp -Wl,--start-group -lglfw3 -lgdi32 -lopengl32 -lglew32s -Wl,--end-group sum_of = sum(matrix[][]);
sum_of = sum(n, matrix);int sum (int n, int matrix[n][n]) { int sum = 0; for (int j = 0; j < n; ++j){ for (int i = 0; i < n; ++i){ if (j == i){ sum += matrix[j][i]; } } } return sum; }
int sum (int n, int matrix[n][n])
{
int sum = 0;
for (int i = 0; i < n; ++i) {
sum += matrix[i][i];
}
return sum;
} Стоит ли сокращать код? И как?
struct
{
bool btn_state;
bool btn_flag;
bool hold_flag;
bool counter_flag;
bool isHolded_f;
bool isRelease_f;
bool isPress_f;
bool step_flag;
bool oneClick_f;
bool isOne_f;
} fl;
fl flags;
// ........
boolean GButton::isFlag(bool& flag) {
if (_tickMode) GButton::tick();
if (flag) {
flag = false;
return true;
} else return false;
}
boolean GButton::isPress() {
return isFlag(flags.isPress_f);
}
boolean GButton::isRelease() {
return isFlag(flags.isRelease_f);
}
boolean GButton::isClick() {
return isFlag(flags.isOne_f);
}
boolean GButton::isHolded() {
return isFlag(flags.isHolded_f);
} switch(1){ case 1: double d = 1; //ошибка }
Почему нельзя инициализировать в case?
It is possible to transfer into a block, but not in a way that bypasses declarations
with initialization. A program that jumps from a point where a local variable with
automatic storage duration is not in scope to a point where it is in scope is ill-formed
unless the variable has POD type (3.9) and is declared without an initializer. Как объявить их так, чтобы избежать подобных ошибок?
class someClass {
public:
void someClassTool();
int variableInClass = 5;
};
Someclass someclass;
void someUniversalTool()
{
int variable1 = someClass.variableInClass ;
//some additional code
}
void SomeClass::someClassTool()
{
someUniversalTool();
//some additional code
} double * func(double *p, int a, int b) { double **p1 = &p; *(int*)p = a; *(int*)p++ = b; return *p1; }
void func(double *p, int a, int b)
{
*(int*)p = a;
*((int*)p + 1) = b;
}void func(double *p, int a, int b)
{
memcpy(p, &a, 4);
memcpy((char *)p + 4, b, 4);
} float del (float a, float b)
{
float res;
...
res = ...;
....
return res;
}
....
float result = del (num1, num2);что делает "return res" во втором куске кода? То есть в переменную res записывается деление числа А и Б. А потом оно куда-то там возвращается..
gdb выдает следующее
char* command; while(strcmp(command, "exit") == 1);