저는 초보자 C 프로그래머로서 그래픽 작업을 처음합니다. 내 MacBook Pro (OS X 10.6.8 실행)에서 제대로 작동하는 일부 OpenGL 기능을 포함하는 코드가 있지만 Linux (CentOS 버전 2.16.0)를 실행하는 내 사무실 컴퓨터에서는 컴파일되지 않습니다. 두 경우 모두 gcc를 사용하고 있습니다. Mac에서 컴파일 할 때 나는 다음과 같은 옵션을 전달 :OpenGL C 코드는 Mac OS X에서 작동하지만 Linux에서는 작동하지 않습니다.
-lcurses -lX11 -lGL -lm -fast
-I/usr/X11R6/include/ -I/usr/X11R6/include/GL -L/usr/X11R6/lib
-L/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries
-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
나는 다음과 같은 오류가
cem_master.c:159: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
cem_master.c:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
cem_master.c:161: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
을 참조하세요 다음과 같은 옵션
-lcurses -lX11 -lGL -lm
리눅스에서 컴파일 시도 다음 코드 행 :
static WINDOW *mainwnd;
static WINDOW *screen;
WINDOW *my_win;
무엇이 잘못 되었습니까? 이것을 이해하는 방법에 대한 팁?
설명에 대한 응답으로 오류의 원인이되는 부분까지의 첫 번째 줄에서 축소 된 버전의 소스 코드가 있습니다. 나는 includes와/Display Crap/section 사이의 많은 쓰레기를 잘라 냈다. 그러나 여전히 오류가 발생한다.
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <GL/glx.h>
#include <GL/gl.h>
#include <unistd.h>
/* Display Crap */
static WINDOW *mainwnd;
static WINDOW *screen;
WINDOW *my_win;
float xcellwidth;
float ycellwidth;
int current_getch;
int xplotoff;
int yplotoff;
Display *dpy;
Window root;
XVisualInfo *vi;
Colormap cmap;
XSetWindowAttributes swa;
Window win;
GLXContext cx;
XEvent event;
전체 소스 파일을 게시하거나 최소한 첫 번째 줄부터 오류를 일으키는 줄까지 조각을 게시하십시오. –