Thread: C++ and oracle library runtime error

  1. #1
    Registered User
    Join Date
    Jan 2014
    Posts
    139

    C++ and oracle library runtime error

    Can someone please tell me what I am missing?

    I downloaded Oracle instantclient-basic-nt-12.1.0.1.0.zip and instantclient-sdk-nt-12.1.0.1.0.zip and extracted both to c:\oracle\
    I then went into visual studio 2013 and created a Win32 Console application with all default parms.

    I then went into project -> properties -> C/C++ -> General -> Additional Include Directories and added my include path C:\oracle\sdk\include
    I then went into project -> properties -> Linker -> General -> Additional Library Directories and added C:\oracle\sdk\lib\msvc\vc11
    I then went into project -> properties -> Linker -> Input -> Additional Dependancies and added oraocci12.lib

    The program compiles but when I debug i get a RUNTIME error that says "The program can't start because oraocci12.dll is missing from your computer. Try reinstalling the program to fix this problem. But I know the file exists in C:\oracle\sdk\lib\msvc\vc11\oraocci12.lib

    What am I doing wrong? Any help is greatly appreciated!

    This is the code if it makes a difference

    Code:
    #include "stdafx.h"
    #include <iostream>
    #include <occi.h>
     
    using namespace std;
     
    int _tmain(int argc, _TCHAR* argv[])
    {
        oracle::occi::Environment* environment;
        oracle::occi::Connection *con;
        oracle::occi::Statement* stmt;
        oracle::occi::ResultSet* res;
     
        try{
     
            environment = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);
            con = environment->createConnection("gldbuser", "gldbuser", "MYDATABSE");
     
            stmt = con->createStatement("select * from example");
            res = stmt->executeQuery();
     
            while (res->next())
                std::cout << res->getInt(1) << "  " << res->getString(2) << std::endl;
     
            stmt->closeResultSet(res);
            con->terminateStatement(stmt);
            environment->terminateConnection(con);
     
        }
        catch (oracle::occi::SQLException &e){
            std::cout << e.what();
        }
     
        return 0;
     
    }

  2. #2
    Registered User
    Join Date
    Dec 2013
    Posts
    9
    Try putting the lib in the same folder your executeable is. If you don't want to have a copy of the dll everywhere you have a new executeable put it in the correct systems folder. Depends if you're on 64bit or 32bit.

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    It is also possible to put the path to the dll into the path.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Jan 2014
    Posts
    139
    Thanks for the responses.


    I am now getting these errors on this line of code
    Code:
    environment = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);


    Error 1 error LNK2019: unresolved external symbol "public: static class oracle:cci::Environment * __cdecl oracle:cci::Environment::createEnvironment(enum oracle:cci::Environment::Mode,void *,void * (__cdecl*)(void *,unsigned int),void * (__cdecl*)(void *,void *,unsigned int),void (__cdecl*)(void *,void *))" (?createEnvironment@Environment@occi@oracle@@SAPAV 123@W4Mode@123@PAXP6APAX1I@ZP6APAX11I@ZP6AX11@Z@Z) referenced in function _wmain C:\Users\userName\Desktop\C_Oracle_OCI\C_Oracle_OC I\C_Oracle_OCI.obj C_Oracle_OCI



    Error 2 error LNK1120: 1 unresolved externals C:\Users\userName\Desktop\C_Oracle_OCI\Debug\C_Ora cle_OCI.exe 1 1 C_Oracle_OCI


    Also the link I used to download the files is here
    Instant Client downloads for Microsoft Windows (x64)
    instantclient-basic-windows.x64-12.1.0.1.0.zip and
    instantclient-sdk-windows.x64-12.1.0.1.0.zip




    Also I am using visual studio 2010
    and I changed the linker path to point to C:\oracle\sdk\lib\msvc\vc10 instead of vc11 but I get the same error
    Last edited by EverydayDiesel; 01-16-2014 at 09:59 AM.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    But it worked before, did it not? Did you change something from the working code?
    Double check to see if the .lib file is in the additional dependencies.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Jan 2014
    Posts
    139
    Could it be that I started a Win32 console app but those drivers are 64?
    (I am on a different machine so I had to create a new project)

    Edit, I installed the 32 bit drivers and now I am back to the same error. I will move the files to the debug folder
    Last edited by EverydayDiesel; 01-16-2014 at 10:07 AM.

  7. #7
    Registered User
    Join Date
    Jan 2014
    Posts
    139
    So I moved the file 'oraocci12.dll' to C:\Users\UserName\Desktop\C_Oracle_OCI\Debug\oraoc ci12.dll

    Now I get the error 'The application was unable to start correctly (0xc000007b). Click OK to close the application.

    I have tried to clean/rebuild but keep getting the same error.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You can create a 64-bit configuration by clicking on the combobox where it says debug and selecting configuration manager. Then, click the arrow on the platform icon and select new. Select x64, tick "create new solution platforms" and OK and OK again.
    Now you should see a 64-bit configuration next to your debug combobox (the combobox which usually says win32).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Registered User
    Join Date
    Jan 2014
    Posts
    139
    Your a genius!
    It is failing on the connection part to the database but I believe that to be environment specific.

    Thanks ALOT for your help!!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Runtime library error
    By mantracker in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2012, 12:48 PM
  2. What is a Runtime Library in C/C++
    By thavali in forum C++ Programming
    Replies: 13
    Last Post: 04-12-2011, 01:05 AM
  3. link with C runtime library
    By George2 in forum C++ Programming
    Replies: 26
    Last Post: 02-05-2008, 01:56 AM
  4. runtime library option
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-30-2007, 08:45 AM
  5. A runtime library error on this line???
    By Unimatrix_001 in forum C++ Programming
    Replies: 2
    Last Post: 09-04-2003, 03:42 PM

Tags for this Thread