2

makefileを使用して非常に短いc++ファイルをコンパイルしています。ClanLibという名前の外部ライブラリを使用してc++ファイルをコンパイルしていますが、「make」コマンドを使用してシェルでコンパイルできるため、c++ファイルとmakefileは重要ではありません。大丈夫です。

#include <ClanLib/core.h>
#include <ClanLib/application.h>

class ConsoleProgram {
public:
    static int main(const std::vector<CL_String> &args);
};
CL_ClanApplication app(&ConsoleProgram::main);
int ConsoleProgram::main(const std::vector<CL_String> &args) {
    CL_SetupCore setup_core;
    CL_ConsoleWindow console_window("Console");
    CL_Console::write_line("Hello World!");
    CL_Console::wait_for_key();
    return 0;
}




BIN     = main
OBJF    = main.o
LIBS    = clanCore  clanDisplay  clanGL  clanGL1  clanApp clanSWRender
VERSION = 2.3

PACKAGES = $(patsubst %, %-$(VERSION), $(LIBS))
INCLUDE += -I/usr/include/ClanLib-2.3/ 
CXXFLAGS += $(INCLUDE) `pkg-config --cflags $(PACKAGES)` -pthread

all: $(BIN)

$(BIN): $(OBJF)
    $(CXX) $(CXXFLAGS) $(OBJF) -o $(BIN) `pkg-config --libs $(PACKAGES)`

clean:
    find . -name '*.o' -type f -print -exec rm -rf {} \;
    rm -f $(BIN)

%.o : %.cpp
    $(CXX) $(CXXFLAGS) -c $< -o $@

%.o : %.hpp
    $(CXX) $(CXXFLAGS) -c $< -o $@

しかし、日食でコンパイルしているときに多くのエラーが発生します。朝からグーグルを続けていますが、手がかりはありません。

/usr/include/ClanLib-2.3/ClanLib/Core/Crypto/aes128_decrypt.h:116:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
In file included from /usr/include/ClanLib-2.3/ClanLib/core.h:217:0,
                 from main.cpp:1:
/usr/include/ClanLib-2.3/ClanLib/Core/Crypto/aes192_encrypt.h:114:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
In file included from /usr/include/ClanLib-2.3/ClanLib/core.h:218:0,
                 from main.cpp:1:
/usr/include/ClanLib-2.3/ClanLib/Core/Crypto/aes192_decrypt.h:116:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
In file included from /usr/include/ClanLib-2.3/ClanLib/core.h:219:0,
                 from main.cpp:1:
/usr/include/ClanLib-2.3/ClanLib/Core/Crypto/aes256_encrypt.h:114:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
In file included from /usr/include/ClanLib-2.3/ClanLib/core.h:220:0,
                 from main.cpp:1:
/usr/include/ClanLib-2.3/ClanLib/Core/Crypto/aes256_decrypt.h:116:2: error: ‘shared_ptr’ in namespace ‘std’ does not name a type
make: *** [main.o] Error 1

手がかりやアドバイスをいただければ幸いです。

私はFedora17x86_64、Eclipseインディゴを使用しています。

4

1 に答える 1

4

std=c++0xを取得するには、g++ コンパイラ フラグに追加する必要がありますstd::shared_ptr

于 2012-09-08T08:29:04.953 に答える