Author Topic: CodeBlock cannot find header file  (Read 17983 times)

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
CodeBlock cannot find header file
« on: November 11, 2012, 06:27:20 pm »
I started learning CodeBlock from yesterday and I want to use MinGW compiler with it. How can I use MinGW with CodeBlock. I asked this question because. I am testing a database connection program in C. I include these files this way in CodeBlock
Setting->Linker Setting-Add
C:\SQLAPI\lib\libsqlapiddll.a 
C:\MinGW\lib\libuser32.a
C:\MinGW\lib\libversion.a
C:\MinGW\lib\liboleaut32.a
C:\MinGW\lib\libole32.a

And this is the code but it is giving error - C:\MinGW\lib\cppmsql.c   2   fatal error: SQLAPI.h: No such file or directory
c Code -
Code
#include <stdio.h>  // for printf
#include <SQLAPI.h> // main SQLAPI++ header
int main(int argc, char* argv[])
{
    SAConnection con; // create connection object
      try
    {
        con.Connect(
            "localhost:3306@bill",     // database name
            "root",   // user name
            "");   // password
                  //optional client name not provided
        printf("We are connected!\n");
        con.Disconnect();
        printf("We are disconnected!\n");
    }
    catch(SAException &x)
    {
        try
        {
            con.Rollback();
        }
        catch(SAException &)
        {
        }
        printf("%s\n", (const char*)x.ErrText());
    }
     return 0;
}

How can solve this problem. Thanx in advance for any suggestion or guidance

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #1 on: November 11, 2012, 06:39:06 pm »
You have to setup include search paths.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #2 on: November 11, 2012, 06:51:03 pm »
I am just 1 user og codeblock I don't know how to setup include search path. Please guide me

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: CodeBlock cannot find header file
« Reply #3 on: November 11, 2012, 06:53:42 pm »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #4 on: November 11, 2012, 07:07:04 pm »
AS per documentation under the For your Project option 1st step is - Right click on the project then select Build options but unfortunately I am not getting this option. I'm using CodeBlock 10.05


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #5 on: November 11, 2012, 07:32:41 pm »
Do you have a project?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #6 on: November 11, 2012, 07:36:27 pm »
No I simply created a New File and saved it as cppmsql.c after writing the above code and adding the libraries which I mentioned in my post. And compiler is GNU GCC compiler

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #7 on: November 11, 2012, 07:38:49 pm »
Then create a project.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #8 on: November 11, 2012, 07:54:59 pm »
Yes now I have a c console project and a file named as main.c which is default. And I also added the code but still same error

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #9 on: November 11, 2012, 08:09:35 pm »
Is this header present at all?
Have you carefully read the posted link and/or the other bullets in the FAQ?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #10 on: November 11, 2012, 08:31:36 pm »
yes header file is present under C:\SQLAPI\include

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #11 on: November 11, 2012, 08:47:35 pm »
Then you know the path, just add it in the project build options...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #12 on: November 11, 2012, 09:11:34 pm »
pls see the attached screen shot, I'm I on correct way

[attachment deleted by admin]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #13 on: November 11, 2012, 10:06:33 pm »
pls see the attached screen shot, I'm I on correct way
No, because you don't make a difference between a compiler and linker errors.

Make sure you read this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
carefully and understand it! Until then you won't progress much.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline vishalonne

  • Single posting newcomer
  • *
  • Posts: 9
Re: CodeBlock cannot find header file
« Reply #14 on: November 11, 2012, 11:18:51 pm »
Thankx a lot for your guidance. program is compiled successfully. But Now next problem is standing in front of me.
On compilation I am getting this message
Quote
-------------- Build: Debug in database ---------------

Compiling: main.cpp
Linking console executable: bin\Debug\database.exe
Output size is 38.12 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

But when I run the program it opens a error message dialog box -
Quote
The program can't start because libsqlapid.dll is missing from your computer. Try reinstalling the program to fix this problem.
I made all the setups for linker which is C:\SQLAPI\lib\libsqlapiddll.a from build option
Guide me please

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlock cannot find header file
« Reply #15 on: November 11, 2012, 11:30:15 pm »
Copy the dll. Also read and understand how dynamic linked libraries work in windows. MSDN has probably a pretty good article about it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]