Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: itsmarky10 on February 04, 2017, 10:34:34 pm

Title: Compile error: SQLAPI.h no such file or directory.
Post by: itsmarky10 on February 04, 2017, 10:34:34 pm
Hello,
I have a version 16.01 codeblocks and I'm trying to compile using C++ to database connection. However it gives me a compiler error.
This is the link what I am following. https://www.crazyengineers.com/threads/database-connectivity-using-c-c-tutorial.23155/
So far, I clicked on settings -> compiler ->  linker settings, and include the following:
C:\SQLAPI\lib\libsqlapiddll.a 
   C:\Program Files\CodeBlocks\MinGW\lib\libuser32.a
   C:\Program Files\CodeBlocks\MinGW\lib\libversion.a
   C:\Program Files\CodeBlocks\MinGW\lib\liboleaut32.a
   C:\Program Files\CodeBlocks\MinGW\lib\libole32.a
But I still got a compiler error like that. Can anyone walk me through how to resolve this issue?

fatal error: SQLAPI.h: No such file or directory
 #include <SQLAPI.h> // main SQLAPI++ header


Here is my code.
#include <stdio.h>  // for printf
#include <SQLAPI.h> // main SQLAPI++ header

int main(int argc, char* argv[])
{
    SAConnection con; // create connection object

    try
    {
        // connect to database
        // in this example it is Oracle,
        // but can also be Sybase, Informix, DB2
        // SQLServer, InterBase, SQLBase and ODBC
        con.Connect(
            "test",     // database name
            "tester",   // user name
            "tester",   // password
            SA_Oracle_Client);

        printf("We are connected!\n");

        // Disconnect is optional
        // autodisconnect will ocur in destructor if needed
        con.Disconnect();

        printf("We are disconnected!\n");
    }
    catch(SAException &x)
    {
        // SAConnection::Rollback()
        // can also throw an exception
        // (if a network error for example),
        // we will be ready
        try
        {
            // on error rollback changes
            con.Rollback();
        }
        catch(SAException &)
        {
        }
        // print error message
        printf("%s\n", (const char*)x.ErrText());
    }

    return 0;
}

                                            ^
Title: Re: Compile error: SQLAPI.h no such file or directory.
Post by: stahta01 on February 04, 2017, 10:41:47 pm
Read these FAQs
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28general%29#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F)
http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_What_do_I_need_to_know_when_using_3rd_party_libs.3F)
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Edit: Please use Code Tags when posting code or logs!

Tim S.