我已经读过这篇文章,但这对我来说似乎是一个不同的问题.
在makefile中运行的命令是,
g++ -o main main.cpp -lglfw -framework Cocoa -framework OpenGL
Run Code Online (Sandbox Code Playgroud)
我运行makefile时收到的错误是,
Undefined symbols for architecture x86_64:
"_IOMasterPort", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceMatching", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOServiceGetMatchingServices", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOIteratorNext", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IORegistryEntryCreateCFProperties", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
"_IOCreatePlugInInterfaceForService", referenced from:
__glfwInitJoysticks in libglfw.a(cocoa_joystick.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud) 我刚刚买了一台二手Macbook,我一直在Sublime Text 2中编写代码并在终端中使用g ++*进行编译.我写了一篇愚蠢的文字冒险,我想发送给朋友,如果可能的话,我想知道Mac上是否有任何方法可以编译exe,类似于我编写代码的方式(即仅与终端有关).
我知道简单的解决方案是在Windows计算机上编译.cpp文件,但我的计算机一直在房间的另一边.
谢谢.
*由于使用Snow Leopard并且太紧张而无法购买OSX Lion或Apple开发人员许可来访问Xcode.如果有人遇到同样的问题,那么我在这里找到了这个解决方案(https://github.com/kennethreitz/osx-gcc-installer和http://cims.clayton.edu/csci1301/how_to/compiling_c_on_a_mac.htm).允许你规避Apple的废话.
我在Procesisng中编写了一个程序,它使用随机颜色和旋转的不透明立方体呈现在彼此之上,但我希望在程序运行时单独连续旋转每个立方体.这是我目前的代码,
int boxval = 1;
void setup(){
size (640, 320, P3D);
frameRate(60);
}
void draw(){
for (int i = 0; i < boxval; i++){
translate(random(0,640), random(0,320), 0);
rotateY(random(0,360));
rotateX(random(0,360));
rotateZ(random(0,360));
fill(random(0,255),random(0,255),random(0,255),50);
noStroke();
box(64,64,64);
}
}
Run Code Online (Sandbox Code Playgroud)
这是截图,如果它有帮助,
