读书人

急人生第一个Solaris下的c++程序失败:

发布时间: 2012-03-23 12:06:21 作者: rapoo

急!人生第一个Solaris下的c++程序失败:ld: fatal: file test1.cc: unknown file type
我程序如下:
/tmp/test1.cc
-------------------------------------
#ifdef _UNICODE
#define _T(x) L##x
#else
#define _T(x) #x
#endif

#include <iostream>
#include <string>

int main() {
using std::string;
using std::cout;

string oStr = _T( "这是中文 ");

cout < <oStr < <endl;
}
----------------------------------------

执行如下语句:

% cd /tmp
% chmod 777 test1.cc
% /pub/tools/compilers/SunOS_5.9/bin/cc test1.cc
ld: fatal: file test1.cc: unknown file type
ld: fatal: File processing errors. No output written to a.out

何故?

[解决办法]
有 CC 否?需要一个 C++ 编译器。cc 是 C 编译器

[解决办法]
我看也是。

ld: fatal: file test1.cc: unknown file type

都说了不知道文件类型。
[解决办法]
/pub/tools/compilers/SunOS_5.9/bin/cc test1.cc
路径怎么这么怪异?
我的路径:
/software/SUNWspro/bin/CC

同意楼上两位意见。

读书人网 >C++

热点推荐