Cannot open include file "sqlapi.h" in C++?

4.5k views Asked by At

I am trying to connect c++ with SQLBase. After building my project I get an error as " Cannot open include file: 'SQLAPI.h': No such file or directory ".

#include <stdio.h>
#include <SQLAPI.h> // main SQLAPI++ header
#include <sbAPI.h> 

Can someone please tell me why am I getting this error and how to fix it?

3

There are 3 answers

2
Some programmer dude On

The file "SQLAPI.h" is not in the include path. You need to add the path to the header files to the compilation flags.

If you are using GCC then add a flag -I like this:

g++ -I/path/to/headers <rest of arguments>

See http://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html for the -I option.

If using a Makefile, change CFLAGS or CXXFLAGS to add the -I option.

If using Visual Studio, go into the project properties dialog, select "Configuration Properties" and "VC++ Directories", and modify the "Include Directories" property. (Based on Visual C++ 2010 Express, should be similar in older versions.)

0
zero On

I am learning C in Microsoft Visual C++ Express platform. A way may work: You should copy your own header files(like SQLAPI.h) to your solution file.

Obviously, it is a complicated way when you want to add much more of your own header files. You have to copy many times. There must be one simpler way to solve this problem by using system path or something else. But, I didn't solve it in this method totally.

Last, good luck. Hope it will be helpful.

0
xacinay On

For VS 2008 C++ you need to set the following Project options:

  [Project options dialog]
    C\C++ 
     Additional Include Directories = C:\Dev\Tools\Win32\SQLApi\3.8.2\include 
    Linker
      General
        Additional Library Directories - C:\Dev\Tools\Win32\SQLApi\3.8.2\lib
      Input
        Additional Dependencies - sqlapis.lib

Warning: example path provided! Instead of 'C:\Dev\Tools...' set your actual SQLAPI++ library instance location!