繁体   English   中英

一个简短的C ++文件和Makefile:我可以在shell,但许多错误,而在Eclipse构建它

[英]A short c++ file and makefile: I can make in the shell, but get lots of error while building it in the Eclipse

我正在使用makefile编译一个非常短的c ++文件。该c ++文件使用名为ClanLib的外部库,但这不是重点,因为我可以在外壳程序中使用“ 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

任何线索或建议将不胜感激。

我正在使用Fedora 17 x86_64,eclipse indigo。

您需要将std=c++0x添加到g ++编译器标志中以获得std::shared_ptr

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM