use*_*358 1 c compatibility compilation clang c++11
我有一个用C编写的程序.原始的makefile有"gnu99".Clang编译它没有额外的命令行选项.但是,如果我包含一个用c ++ 11编写的只有头文件库(变量模板=>无法单独编译),那么地狱就会松散......
使用'clang inputfile.c staticlib.a -lsomelib'进行简单编译会产生如下错误:
error: unknown type name 'namespace'
error: unknown type name 'template'
... much much more ...
Run Code Online (Sandbox Code Playgroud)
所以它试图将c ++编译为普通c
如果我尝试'clang ++ -std = c ++ 11 -stdlib = libc ++ inputfile.c staticlib.a -lsomelib',那么:
error: expected ';' after enum
error: cannot initialize a variable of type 'rssFeedState *' with an lvalue of type 'void *'
... much much more ... !!!!! I want to make it ignore these !!!!
Run Code Online (Sandbox Code Playgroud)
重写.c文件以编译为c ++是最后一个选项
如何让clang正确处理这种情况?
即:将.c文件编译为c,但处理其中一个包含的头文件为c ++ 11(实例化可变参数模板,识别名称空间,c ++ 11标准库,......)
| 归档时间: |
|
| 查看次数: |
1761 次 |
| 最近记录: |