Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-31-2009, 03:40 PM   #1
LQ Newbie
Registered: Aug 2009
Posts: 8

Rep: Reputation: 0
C++, where does the preprocessor search for .h files?

hello, i have finished installing mysql, howeve some of the files were missing, like mysql.h. anyway i have downloaded a DEV version which has all the files im looking for, however when i add my c++ file to the directory that they are in, it still does not run because it cannot find the mysql.h where does the compiler look for these files, or where should i put them?
Old 08-31-2009, 05:24 PM   #2
LQ Newbie
Registered: Aug 2009
Posts: 8

Original Poster
Rep: Reputation: 0
ok, just another thing, i have managed to install mysql fully along with all the libraries, now how do i compile a program, that has:
'#include <mysql.h>'
this says that it cant find mysql.h, so how do i tell the compiler where the libraries are?
Old 08-31-2009, 06:17 PM   #3
Registered: Nov 2005
Location: California
Distribution: ubuntu 10
Posts: 162

Rep: Reputation: 33
The extent of my programming skill is ./configure; make; make install, but I'd guess your compiler manual tells you how to specify library paths. Failing that, the internet probably has a newbie guide for C++ that tells you how to specify a library path in the code.

When I extract a source package to compile it, I sometimes see a lib/ folder, and I'd guess the script tells make that this is where important library files are, and make then runs the appropriate commands. If I were you, I'd download a souce package (or use your mysql package), and examine the and make files, see if you can work it out. For that matter, examine the program source code too. Learn by example!

Last edited by djeikyb; 08-31-2009 at 06:20 PM.
Old 08-31-2009, 06:26 PM   #4
Registered: Sep 2005
Distribution: Gentoo, Sabayon, Puppy, Arch
Posts: 165

Rep: Reputation: 29
Put your cpp file anywhere you want, and call g++ with a -I/path/to/mysql/includes so that it looks like this:

g\+\+ file.cpp -I/usr/include/mysql -o file
That will tell g++ to look for includes in the given directory.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to search files in nautilus sumeet inani Linux - Newbie 13 06-30-2016 03:09 PM
Search tools (Affinity, Tracker Search Tool, etc.) not working - don't find any files Adamantus Linux - Newbie 1 03-30-2009 12:21 AM
C pre-preprocessor or preprocessor replacement Tischbein Programming 3 02-11-2007 12:38 PM
how do i search files for a particular string? darkpark Linux - Newbie 4 07-05-2005 06:46 PM
Search for Files vs. ls albean Linux - Newbie 2 11-14-2004 03:35 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration