News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

CodeBlock cannot find header file

Started by vishalonne, November 11, 2012, 06:27:20 PM

Previous topic - Next topic

vishalonne

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 -

#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

oBFusCATed

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!]

vishalonne

I am just 1 user og codeblock I don't know how to setup include search path. Please guide me

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

vishalonne

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


oBFusCATed

(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!]

vishalonne

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

oBFusCATed

(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!]

vishalonne

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

oBFusCATed

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!]

vishalonne

yes header file is present under C:\SQLAPI\include

oBFusCATed

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!]

vishalonne

pls see the attached screen shot, I'm I on correct way

[attachment deleted by admin]

oBFusCATed

Quote from: vishalonne on November 11, 2012, 09:11:34 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!]

vishalonne

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 -
QuoteThe 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