0
我在編譯Linux操作系統(LUbuntu 15.05)上的C++代碼時遇到了問題。包含的標題C++錯誤
我在XUbuntu 14.10,Arch和Gentoo Linux上編譯的代碼相同。一切都很好。現在,我在回家的臺式PC安裝LUbuntu,當我開始讓我給這個錯誤:
g++ -O2 -Wall -o main.o main.cpp
In file included from /usr/include/i386-linux-gnu/c++/5/bits/gthr-default.h:35:0,
from /usr/include/i386-linux-gnu/c++/5/bits/gthr.h:148,
from /usr/include/c++/5/ext/atomicity.h:35,
from /usr/include/c++/5/bits/ios_base.h:39,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iostream:39,
from main.h:8,
from main.cpp:1:
/usr/include/pthread.h:1058:55: error: ‘_lock’ was not declared in this scope
extern int pthread_spin_trylock (pthread_spinlock_t *[_lock)
^
/usr/include/pthread.h:1058:54: error: expected ‘,’ or ‘...’ before ‘[’ token
extern int pthread_spin_trylock (pthread_spinlock_t *[_lock)
^
Makefile:30: recipe for target 'main.o' failed
make: *** [main.o] Error 1
這是我main.h文件:
#ifndef MAIN_H
#define MAIN_H
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_image.h>
#include <iostream>
#include <vector>
#endif // MAIN_H
我不知道該怎麼辦。我安裝build-essential。 請幫忙。
好吧,那不是C++語法。如果你有權訪問該文件,從''('pthread_spinlock_t * [_ lock)' – xinaiz