I m using oracle pro compiler to connect to the database and execute dml statement in a C++ program using visual studio 2005. when this procompiler connects to database, it creates a communication area known as sqlca.
I have connected a file named test2.cpp, to databse using this compiler. Till now it works well. But when I use this compiler to connect to database in another file named test3.cpp, of the same project, then the compiler gives me an error of redefinition of sqlca.
The error looks like:

test3.obj : error LNK2005: "struct sqlca sqlca" (?sqlca@@3U0@A) already defined in test2.obj
Debug/AFEClientPublic.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://d:\AfeClientPublic43\AFEClientPublic43\Debug\BuildLog.htm"
AFEClientPublic - 2 error(s), 0 warning(s)

Thanks in advance.

11 Years
Discussion Span
Last Post by Ancient Dragon

It means you have declare the same sqlca object in both *.cpp files. If you want to use the same object in both files use the extern keyword in one of the two files, like this: extern struct sqlca sqlca .

You should use some other name for the object -- makes your program easier to read if you name objects something other than the name of the structure.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.