OCCI unresolved externals (createEnvironment / terminate Environment)

From: Martin Kosina <martink_at_renkodesign.com>
Date: 1 Jan 2003 22:13:02 -0800
Message-ID: <6f5e56e0.0301012213.231a8787_at_posting.google.com>



Hi all,

[Quoted] I am trying to compile and link a simple client on Linux using the C++ call-level interface (OCCI). Everything compiles and links fine against libclntsh.so, except for the createEnvironment() and terminateEnvironment() calls, which the linker cannot find. For the record, this is oracle 9.2.0.1 under RedHat 7.3 with gcc 3.1. Here is the minimal program:

  • Top of file ------------------------

#include <occi.h>
#include <iostream>

using namespace oracle::occi;

int main()
{

	Environment*	env;
	Connection*	conn;
	Statement*	stmt;
	ResultSet*	rs;

	try 
	{
	        env = Environment::createEnvironment(Environment::DEFAULT);
		conn = env->createConnection( "SCOTT", "TIGER","");
		stmt = conn->createStatement();
		
		std::string QueryString = "SELECT * from dep";

		rs =stmt->executeQuery (QueryString);
		rs =stmt->getResultSet ();

		while(rs->next())
		{
			std::cout << "\nProcessing";
		}

		stmt->closeResultSet(rs);
	}
	catch (SQLException &e) 
	{
		std::cout << "SQL exception :" << e.getMessage() << std::endl;
	}

	conn->terminateStatement(stmt);
	env->terminateConnection(conn);
	Environment::terminateEnvironment(env);

	return 0;

}
  • End of file ------------------------

Output of the compile and link steps:

g++ -c -g -o "Debug/orasync.o" -I/backup/oracle/OraHome1/rdbms/demo/ -I/backup/oracle/OraHome1/rdbms/public/ "/home/martink/orasync/orasync/orasync.cpp" g++ -g -o "Debug/orasync" Debug/orasync.o -L/backup/oracle/OraHome1/lib -lclntsh -locci9 Debug/orasync.o: In function `main':
/home/martink/orasync/orasync/orasync.cpp:16: undefined reference to `oracle::occi::Environment::createEnvironment(oracle::occi::Environment::Mode, void*, void* (*)(void*, unsigned), void* (*)(void*, void*, unsigned), void (*)(void*, void*))'
/home/martink/orasync/orasync/orasync.cpp:39: undefined reference to `oracle::occi::Environment::terminateEnvironment(oracle::occi::Environment*)' collect2: ld returned 1 exit status

Note that none of the other OCCI calls are unresolved, just those two (unlike when -lclntsh is omitted, in which case all become unresolved). The platform-specific Admin guide only mentions linking against libclntsh, are there any other libraries I am missing ? Something that didn't get built during installation maybe ? (I did re-run the various genxxx scripts).

I have no problems linking C-based OCI code against libclntsh, just those two calls in OCCI...

Thanks for any pointers,

Martin Received on Thu Jan 02 2003 - 07:13:02 CET

Original text of this message