xlC编译C++报错

yyw6637 2013-01-16 03:16:15
a.cpp


#include <string>
#include <iostream>
#include <map>
#include <string>
#include "test.h"
using namespace std;
#define GETS(msg) printf("%s\n",msg);
struct Student{
char name[30];
int age;
char sex[4];

}stu1,stu2={"zhangsan",22,"boy"};
FILE *p_fp;
char c_str[1000];
char c_Str[10];
//map<string, int> my_Map;
char *ps[3];
char *pd[3]={"username","userpass","database"};

int k=0;
int main(int argc,char *argv[])
{
cout<<"sdfds";
my_Map.insert(make_pair<string,int>("d",4));
//cout<<"哈哈"<<endl;
sun(1,4);
GETS("你好");
if ((p_fp=fopen(argv[1],"r"))==NULL)
printf("打开配置文件%s失败!\n",argv[1]);

else{
while (!feof(p_fp))
{

if (fgets(c_str, 25, p_fp) != NULL){
char *p;
p=strstr(c_str,"=");
printf("c_str%s\n",p);
ps[k]=p;
k=k+1;
}

}
}
for(int i=0;i<3;i++){
printf("%s=%s\n",pd[i],ps[i]);
}
printf("My name is : %s\n","山炮");
printf("dd=%d\n",d);
CServices cs1;
cs1.add();
return 0;
}
void CServices::add(){
printf("dddddddddddd:%s\n","aaaaaaaaaaaaaaaa");
printf("结构体:%d\n",stu2.age);
}


test.h


#ifndef test_h
#define test_h
//#include <math>
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define BBB 80
#define DDD 60
#ifdef AAA
using namespace std;
int i=3;
#else
int i;
#endif
int d=14;
#define demo(H) if(2>3)\
{\
d=15;\
printf("error : %s\n");\
}\
else\
d=18;
int c=0;
void sun(int a,int b)
{
printf("a+b=%d\n",a+b);
demo("error");
}

#endif
class CServices
{
public:
CServices(){printf("构造函数\n");};
void add();

};


makefile

##################################C程序#########################
edit:test1.o
@cc -o edit test1.o
test1.o:test1.c test.h
@cc -c test1.c
@cc test1.o -o test1
@test1

#################################C++程序#########################
CPP = xlC_r7 -q64 -bh:5 -g
CFLAGS = -c -o
LFLAGS = $(PLATFORM_DEF) -D_REENTRANT -D_THREAD_SAFE -g -w -o
LIB = -L$(PATH_LIB)
PATH_TEST =/ngbss/mddms/interface/other/SRBI/test

OBJ_TEST =\
$(PATH_TEST)/a.o\
$(PATH_TEST)/b.o\


exec_test:
@$(CPP) $(OBJ_TEST)

$(PATH_TEST)/a.o:
@$(CPP) $(CFLAGS) $@ $(PATH_TEST)/a.cpp
$(PATH_TEST)/b.o:
@$(CPP) $(CFLAGS) $@ $(PATH_TEST)/b.cpp


test:$(OBJ_TEST) exec_test
@cc a.o -o a
@cc b.o -o b
@a
@b



make test


[/ngbss/mddms/interface/other/SRBI/test]$make test
ld: 0711-317 ERROR: Undefined symbol: .clear__Q2_3std8ios_baseFib
ld: 0711-317 ERROR: Undefined symbol: __dl__FPv
ld: 0711-317 ERROR: Undefined symbol: .uncaught_exception__3stdFv
ld: 0711-317 ERROR: Undefined symbol: .__dt__Q2_3std7_LockitFv
ld: 0711-317 ERROR: Undefined symbol: .__dl__FPv
ld: 0711-317 ERROR: Undefined symbol: .__ct__Q2_3std7_LockitFi
ld: 0711-317 ERROR: Undefined symbol: .__ReThrowV6
ld: 0711-317 ERROR: Undefined symbol: .__setUncaughtExceptionFlag__3stdFb
ld: 0711-317 ERROR: Undefined symbol: .__CleanupCatchV6a
ld: 0711-317 ERROR: Undefined symbol: cout__3std
ld: 0711-317 ERROR: Undefined symbol: .unexpected__3stdFv
ld: 0711-317 ERROR: Undefined symbol: .terminate__3stdFv
ld: 0711-317 ERROR: Undefined symbol: .__ThrowV6
ld: 0711-317 ERROR: Undefined symbol: ._Toupper
ld: 0711-317 ERROR: Undefined symbol: ._Tolower
ld: 0711-317 ERROR: Undefined symbol: ._Getctype__FPCc
ld: 0711-317 ERROR: Undefined symbol: _Cltab__Q2_3std5ctypeXTc_
ld: 0711-317 ERROR: Undefined symbol: .__dt__Q2_3std8_LocinfoFv
ld: 0711-317 ERROR: Undefined symbol: .__ct__Q2_3std8_LocinfoFPCci
ld: 0711-317 ERROR: Undefined symbol: .__nw__FUl
ld: 0711-317 ERROR: Undefined symbol: _Id_cnt__Q3_3std6locale2id
ld: 0711-317 ERROR: Undefined symbol: id__Q2_3std5ctypeXTc_
ld: 0711-317 ERROR: Undefined symbol: ._Getfacet__Q2_3std6localeCFUl
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
make: The error code from the last command is 8.



用到string CString map cout cin等等是总是报这样的错误,请教各位是为什么
...全文
127 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

64,674

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧