本文介绍了我无法使用RHEL 3 ES在C ++程序中编译嵌入式SQL。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在Red Hat Linux 7.3上运行的一些程序在我的旧机器上使用IBM DB2 V6.1(带有所有的FixPack)。 我刚刚在运行Red Hat的这台(新)机器上安装了IBM DB2 V8.1 Enterplise Linux 3 ES,并将FixPack fp5_mi00069.tar应用于它。在创建一个实例,启动数据库,创建一个数据库,并输入表定义后,所有这些似乎都工作正常,我进入了一个 微小的8行表,可以对它进行查询。所以服务器似乎是好的b $ b工作正常。顺便说一下,我正在运行个人开发者''版本。 但是,为了更进一步,我必须能够构建我的客户端程序,以支持填充其余部分数据库,这需要我重新编译我的旧RHL 7.3程序,这些程序与DB2 V6.1一起运行,在这台RHEL 3 ES机器上使用 V8.1.5,以及其中嵌入了SQL的C ++程序无法编译。 A /> 编译的语句很少,但重要的不是。 例如,这是构造函数的开头,例如: dbBase :: //自定义构造函数 dbBase(const string& db_name) { EXEC SQL开始声明部分; < ---<<< char dbName [DB_DB2N_SIZE + 1]; | A EXEC SQL END DECLARE SECTION; < ---<<< _connected = false; _dbName ="" ;; if(db_name.empty()){ cerr<< dbBase("<<<< db_name<<"):db_name missing。 << endl; 退出(EXIT_FAILURE); } if(db_name.size()> DB_DB2N_SIZE){ cerr<< dbBase("<<<< db_name<<"):db_name太长。 << endl; 退出(EXIT_FAILURE); } (void)strncpy(dbName,db_name.c_str(),DB_DB2N_SIZE); dbName [DB_DB2N_SIZE] = EOS; //连接到数据库。 EXEC SQL连接到:dbName; < ---<<< B 标记为A的东西。直接通过预处理器和编译器, ,但标有B的行。扼流圈如下: dbBase.i:在构造函数`dbBase :: dbBase(const string&)'': dbBase.i:9122:` NULL''未声明(首先使用此函数) dbBase.i:9122 :(每个未声明的标识符仅在其出现的每个 函数中报告一次。) make:*** [dbBase.o]错误1 这是dbBase.i第9122行 EXEC SQL CONNECT TO:dbName; 我无法继续,直到我解决这个问题(这几乎出现在这个类的每个 函数中,我假设对于所有其他课程也是如此。 除了这个致命错误之外,我收到很多警告信息我不知道不习惯,例如: / usr / bin / g ++ -c -g -Wno-deprecated -mcpu = i686 -march = i686 -O2 -I / home / jdbeyer / include -I / home / jdbeyer / stocks / include -I / usr / include / g ++ - 3 -I / dataA / db2inst1 / sqllib / include dbBase。 CdbBase.C:4011:警告:`typename __default_alloc_template< threads,inst> :: _ Obj ''隐含地是一个类型名称 dbBase.C:5433:警告:`typename basic_string< charT, traits,Allocator> :: Rep'' 隐式是一个类型名称 dbBase.C:5607:警告:`typename basic_string< charT,traits, 分配器> :: size_type''隐式地是一个类型名 ,即使我在编译器命令行中包含_-Wno-deprecated_。我希望不要包含它,并希望修复它。 因为据说RHEL 3支持DB2 V8.1.5,所以我想知道 如何处理这个问题。如果我需要包含一些新的标题标志,请使用 编译器的不同标志或其他东西,我很乐意这样做 (在我的makefile中很容易)。 我很生气,安装fp5_mi00069.tar从系统中删除了所有的html 文档,但我把它还回来了。 - .~。 Jean-David Beyer已注册Linux用户85642. / V \注册机器241939. /()\ Shrewsbury,New Jersey http://counter.li.org ^^ - ^^ 21:05:00 up 9天,21:47,7位用户,平均负载:4.08,4.13,4.10 I have some programs running on Red Hat Linux 7.3 working with IBM DB2V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red HatEnterplise Linux 3 ES, and applied FixPack fp5_mi00069.tar to it. Aftercreating an instance, starting the database, creating a database, andentering the table definitions, all of which seems to work OK, I entered atiny 8-row table and can do queries on it. So the server seems to beworking OK. BTW, I am running Personal Developers'' Edition. However, to go further I must be able to build my client programs topopulate the rest of the database and this requires I recompile my old RHL7.3 programs that work with DB2 V6.1 to run on this RHEL 3 ES machine withV8.1.5, and the C++ programs with embedded SQL in them do not compile. Afew of the statements compile, but the important ones do not. E.g., here is the beginning of a constructor, for example: dbBase::// Custom constructordbBase(const string& db_name){EXEC SQL BEGIN DECLARE SECTION; <---<<<char dbName[DB_DB2N_SIZE + 1]; | "A"EXEC SQL END DECLARE SECTION; <---<<< _connected = false;_dbName = ""; if(db_name.empty()) {cerr << "dbBase(" << db_name << "): db_name missing." << endl;exit(EXIT_FAILURE);}if(db_name.size() > DB_DB2N_SIZE) {cerr << "dbBase(" << db_name << "): db_name too long." << endl;exit(EXIT_FAILURE);}(void) strncpy(dbName, db_name.c_str(), DB_DB2N_SIZE);dbName[DB_DB2N_SIZE] = EOS; // Connect to database.EXEC SQL CONNECT TO :dbName; <---<<< "B" The stuff marked "A" goes right through the preprocessor and compiler,but the line marked "B" chokes as follows: dbBase.i: In constructor `dbBase::dbBase(const string&)'':dbBase.i:9122: `NULL'' undeclared (first use this function)dbBase.i:9122: (Each undeclared identifier is reported only once for eachfunction it appears in.)make: *** [dbBase.o] Error 1 Here is dbBase.i line 9122" EXEC SQL CONNECT TO :dbName; I cannot go on until I fix this problem (that appears in almost everyfunction of this class, and I assume for all other classes as well. In addition to this fatal error, I am getting lots of warning messages Iam not used to, such as: /usr/bin/g++ -c -g -Wno-deprecated -mcpu=i686 -march=i686 -O2-I/home/jdbeyer/include -I/home/jdbeyer/stocks/include-I/usr/include/g++-3 -I/dataA/db2inst1/sqllib/includedbBase.CdbBase.C:4011: warning: `typename__default_alloc_template<threads, inst>::_Obj'' is implicitly a typenamedbBase.C:5433: warning: `typename basic_string<charT, traits, Allocator>::Rep''is implicitly a typenamedbBase.C:5607: warning: `typename basic_string<charT, traits,Allocator>::size_type'' is implicitly a typename even though I include _-Wno-deprecated_ in the compiler command line. Iprefer not to include that, and would like that fixed too. Since DB2 V8.1.5 is supposedly supported on RHEL 3, I would like to knowhow to deal with this. If I need to include some new header flags, usedifferent flags for the compiler or something, I would be glad to do so(easy in my makefiles). I am annoyed that installing fp5_mi00069.tar deleted all the htmldocumentation from the system, but I put it back. --.~. Jean-David Beyer Registered Linux User 85642./V\ Registered Machine 241939./( )\ Shrewsbury, New Jersey http://counter.li.org^^-^^ 21:05:00 up 9 days, 21:47, 7 users, load average: 4.08, 4.13, 4.10 推荐答案 我不明白为什么显示弃用函数的警告会 与上面显示的警告有关。编译器抱怨的5433行或5607行代码是什么?b :我的经验是新的编译器经常引发新的警告/错误 ,因为旧代码不像应该的那么干净。 - Knut Stolze 信息集成 IBM德国/耶拿大学 I don''t see why the warnings to show deprecated uses of functions would berelevant to the warnings shown above. What''s the code in line 5433 or 5607where the compiler complains? p.s: My experience is that newer compilers often raise new warnings/errorsbecause the old code is not as clean as it should have been. --Knut StolzeInformation IntegrationIBM Germany / University of Jena 我不明白为什么显示弃用函数的警告会 与上面显示的警告有关。编译器抱怨的5433行或5607行代码是什么?b :我的经验是新的编译器经常引发新的警告/错误 ,因为旧代码不像应该的那么干净。 - Knut Stolze 信息集成 IBM德国/耶拿大学 I don''t see why the warnings to show deprecated uses of functions would berelevant to the warnings shown above. What''s the code in line 5433 or 5607where the compiler complains? p.s: My experience is that newer compilers often raise new warnings/errorsbecause the old code is not as clean as it should have been. --Knut StolzeInformation IntegrationIBM Germany / University of Jena 麻烦的是,已经存在于文件中。 Trouble is, that is already in the file. 像这样: trillian:jdbeyer [〜/ stocks / src] Like this: trillian:jdbeyer[~/stocks/src] 这篇关于我无法使用RHEL 3 ES在C ++程序中编译嵌入式SQL。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 20:26