| | |
linux C++ include file error
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
Hi everyone!
I am new to C++, started not so long ago. I am writing a database program using sqlite3 and gtkmm (C++ bindings to GTK) GUI toolkit. I am using Eclipse for project building (managed make). In my project, I have two folders - 'db' and 'interface'. here is what inside folders -
Now, I want to initialize the sqlite3 class so it is part of MyFrame and then I can link buttons to use its functions in MyFrame. I try to do this by using #include "db/sqlite3.h" in MyFrame.h, but the compiler says "No such file or directory". If, however, I place the sqlite3 class files into 'interface' folder, everything works fine. But I do not want that - I want to keep things in different folders for better organization (in my opinion). Soon there will more classes and files added to this project, and I don't want to have to dump everything into one 'interface' folder. Please help!!!
I am new to C++, started not so long ago. I am writing a database program using sqlite3 and gtkmm (C++ bindings to GTK) GUI toolkit. I am using Eclipse for project building (managed make). In my project, I have two folders - 'db' and 'interface'. here is what inside folders -
C++ Syntax (Toggle Plain Text)
+project main.cpp +db sqlite3.h sqlite3.cpp +interface MyFrame.h MyFrame.cpp
Now, I want to initialize the sqlite3 class so it is part of MyFrame and then I can link buttons to use its functions in MyFrame. I try to do this by using #include "db/sqlite3.h" in MyFrame.h, but the compiler says "No such file or directory". If, however, I place the sqlite3 class files into 'interface' folder, everything works fine. But I do not want that - I want to keep things in different folders for better organization (in my opinion). Soon there will more classes and files added to this project, and I don't want to have to dump everything into one 'interface' folder. Please help!!!
either you give the complete path in the include statement. or else what you can do is that you can add the complete path in the include path of the compiler. in command prompt we do it by using the compiler option -I. eg
gcc -I<path> file.cpp
you can set this in the makefile or
if its GUI there must be some option to set this path for the compiler.
gcc -I<path> file.cpp
you can set this in the makefile or
if its GUI there must be some option to set this path for the compiler.
Then put it in the makefile and give the makefile with the source code for compilation and yes to make sure the makefile works for anyone, make sure the paths are not hardcoded. use environment variables like $PATH etc. so that it works for anyone in any directory structure..
Last edited by Agni; Jan 31st, 2008 at 1:27 pm.
but say the path in my case would be
surely it would not work on anyone elses machine unless they happen to have the same filepath? Or am I wrong?
C++ Syntax (Toggle Plain Text)
"home/linux0id/.eclipse/workspace/database/db/sqlite3.h"
exactly thats y i mentioned that use environment variables like $MYPATH but yes its always there that you might change the drive in which you place the code etc. but after a point the dir structure has to be the same as urs. i mean suppose you put it in
"e:/linux/eclipse/workspace/" and set $MYPATH as e:/linux then ur makefile will have
$MYPATH/workspace
now the other person might store it in
"c:/temp/project/workspace"
he can set $MYPATH as c:/temp/project and the makefile will work for him provided the final folder is same as urs, which is workspace in this case..
got it?
"e:/linux/eclipse/workspace/" and set $MYPATH as e:/linux then ur makefile will have
$MYPATH/workspace
now the other person might store it in
"c:/temp/project/workspace"
he can set $MYPATH as c:/temp/project and the makefile will work for him provided the final folder is same as urs, which is workspace in this case..
got it?
![]() |
Similar Threads
- Communication Link Failure Error (JSP)
- Moving from Linux to *BSD (Window and Desktop Managers)
- Passing a filestream, how? (C++)
- need help fast (C++)
- how to include a .so file in c++ dll? (Java)
- Modem Not detected :( (*nix Hardware Configuration)
- Errors writing a vector to a file (C++)
- Help Reading Info in Text File Into an Array (C++)
- Compile errors under different Linux OS's (C++)
- VMWare Unrecoverable Error (*nix Software)
Other Threads in the C++ Forum
- Previous Thread: school billing system
- Next Thread: Username/PW entry help
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





