小编use*_*063的帖子

glewInit()在macOS上失败

所以我有一段代码在ubuntu机器上运行良好,但在xcode或终端上没有这样做.我正在尝试在xcode上运行它,但它在main上失败:

"使用未声明的标识符glewInit;你的意思是glutInit吗?" "函数调用的参数太少,预期2,有0"

代码冗长是由我的教授编写的,它运行在ubuntus上.但是由于这些错误,我认为原因是......好吧,明确的标识符,包括缺失.因此,在谷歌搜索之后我发现glewInit是glew库的一部分 - >所以我下载了代码并将其安装在我的机器上,其中包括:

make sudo -s make install

已成功安装到我的/ usr/include/GL中.现在,当我输入xcode #include或只是#include时,编译器抛出找不到glew.h(虽然我可以在usr/include/GL中看到自己的文件).

这是代码:

#include "include/Angel.h"

// The rotation  around z axis
GLfloat  Theta = 0.0; // Angle (in degrees)
GLfloat  step = 0.01; // Incremental
GLuint  locTheta;  
enum { CW = 0, CCW = 1};
int direction = CW;  // Direction

//Scale along x and y axes
GLfloat ScaleFactor[2] = {1.0, 1.0};
GLuint locScale;

const int NumPoints = 4;
void init();
void display( void );
void reshape( GLsizei …
Run Code Online (Sandbox Code Playgroud)

c++ opengl osx-lion

6
推荐指数
1
解决办法
4834
查看次数

一些"怪异"的C代码

我有这个C代码,我有理解的问题:

int foo(int f(int,int), int g(int,int), int x) {

    int y = g(x,x);
    return f(y,y);
}

int sq(int x, int y) {
    if (x == 1) { return y; }
    return pl(y, sq(x-1, y));
}

int pl(int x, int y) {
    if (x == 0) { return y; }
    return pl(x-1, y+1);
}

int main (int argc, const char * argv[])
{
   printf("sq = %d\n", sq);
   printf("output=%d\n", foo(sq, pl, 1));
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

我知道f乘以两个变量而g是乘法,它们显然是内置的.函数foo有两个参数声明为函数声明 - > f(int,int)和g(int,int).但是foo传递了两个参数 - sq和pl.这两个参数也有非常奇怪的值 - …

c

6
推荐指数
1
解决办法
545
查看次数

有没有办法逃离打印语句并将字符串变量视为java中的有效代码?

我正在探索一段代码中的一些安全问题,并想知道是否有办法打破System.out.println("");语句并将字符串视为可执行代码?

例如,我有以下两行:

String exit = "System.exit(0);";
System.out.println(exit);
Run Code Online (Sandbox Code Playgroud)

因此,"System.exit(0);"我希望JVM将其视为可执行代码,而不是打印到控制台.它甚至可能吗?如果是的话,有没有人有关于如何做的想法?

谢谢

java security

1
推荐指数
1
解决办法
92
查看次数

标签 统计

c ×1

c++ ×1

java ×1

opengl ×1

osx-lion ×1

security ×1