compiler error
Wenjin Zheng
wenjin.zheng@lsbc.com
Tue Jun 13 17:32:00 GMT 2000
Hi;
I have included three files, one header, one .cpp file, one driver program
and one make file. If you can make a fake library <libpq++.H> on your
system, I am pretty sure you can regenerate the error I got. But there might
be some kind of directory setup needed by the make file. Thanks for the
help.
Wenjin
////////////////////////////////////////////////////////
// Header file
//////////////////////////////////////////////////////
#ifndef SQL_Map_H
#define SQL_Map_H
#include <map>
#include <string>
#include <vector>
using namespace std;
class SQL_Map : public map<string, vector<string>, std::greater<string> >
{
public:
SQL_Map(string, string);
};
#endif
//////////////////////////////////////////////////////////
// cpp file
////////////////////////////////////////////////////////
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
using namespace std;
#include "SQL_Map.h"
#include <libpq++.H>
SQL_Map::SQL_Map(string aQuery, string aKey)
: map<string, vector<string>, std::greater<string> >()
{
}
/////////////////////////////////////////////////////////
//driver program
/////////////////////////////////////////////////////////
#include <string>
#include <iostream>
using namespace std;
#include "SQL_Map.h"
main()
{
string s("select field, length from lsbtest where barcode=300594");
string aKey("field");
SQL_Map sMap(s, aKey);
map<string, vector<string> >::iterator itr;
for (itr=sMap.begin(); itr!=sMap.end(); itr++)
cout<<(*itr).first<<"\t"<<(*itr).second[0]<<"\t"<<(*itr).second[1]
<<"\t"<<(*itr).second[2]<<"\t"<<(*itr).second[3]<<endl;
return 0;
}
///////////////////////////////////////////////////////////////
//makefile
//////////////////////////////////////////////////////////////
# Makefile
#
SRCDIR= ../../../../..
include ../../../../../Makefile.global
CFLAGS+= -I$(LIBPQDIR)
LDFLAGS+= -L$(LIBPQDIR) -lpq
LIBNAME= libpq++
HEADERDIR= /U07/postgres/usr/src/pgsql/postgresql-6.5/include
LIBPQDIR= /U07/postgres/usr/src/pgsql/postgresql-6.5/lib
# We have to override -Werror, which makes warnings, fatal, because we
# inevitably get the warning, "abstract declarator used as declaration"
# because of our inclusion of c.h and we don't know how to stop that.
CXXFLAGS= $(CFLAGS) -Wno-error -Wno-unused -Wl,-Bdynamic
INCLUDE_OPT= -I$(HEADERDIR)
CXXFLAGS+= $(INCLUDE_OPT)
LDFLAGS+= -L$(LIBPQDIR) -lpq++
#
# And where libpq goes, so goes the authentication stuff...
#
ifdef KRBVERS
LDFLAGS+= $(KRBLIBS)
CXXFLAGS+= $(KRBFLAGS)
endif
objects = SQL_Map.o
testSQL_Map : $(objects) testSQL_Map.o
$(CXX) $(CXXFLAGS) -o $@ $(objects) testSQL_Map.o $(LDFLAGS)
testSQL_Map.o : SQL_Map.h
$(CXX) $(CXXFLAGS) -c testSQL_Map.cpp
.PHONY: submake
clean:
rm -f $(PROGS)
/////////////////////////////////////////////////////////////////////////
-----Original Message-----
From: Benjamin Kosnik [ mailto:bkoz@cygnus.com ]
Sent: Tuesday, June 13, 2000 5:04 PM
To: Wenjin Zheng
Subject: RE: compiler error
please keep this thread, and replies to it on the libstdc++ mailing
list...
> I am using SunOS solaris2.6, the compiler is g++ (EGCS version 1.1.2). I
am
> not sure whether a self-contained piece of code will demonstrate the
problem
> because like I said, if I did not include the third party library and did
> not use their make file, everything is fine. I guess it is some kind of
> compiling option from their make file gave me the error. I just wonder
> whether there is a possibility that from the compiling option I provided
in
> the previous message we can figure out what is the problem. If you need
> more detailed information, let me know. Thanks again for the help.
No, i can't tell what's up from any of your previous messages. I'm going
to need code. Sorry
-benjamin
More information about the Libstdc++
mailing list