PDA

View Full Version : No such file or directory- Simple Link Error Help?



ETweedale
16th February 2010, 16:35
Here are the first few lines of my *.h file:


#ifndef PHYSICSLIB_H
#define PHYSICSLIB_H

#pragma once

#include "Core/element.h"
#include "Core/parameters.h"
#include "Core/smartPointer.h"

#include "Relationships/relationships.h"
#include "Relationships/oneWay.h"
#include "Relationships/twoWay.h"
#include "Relationships/hit.h"

#include "Callbacks/elementDrawer.h"
#include "Callbacks/elementUpdater.h"

After trying to build, the compile output reads:

Starting: c:/qt/2010.01/qt/bin/qmake.exe X:/Cerulean_/Cerulean_.pro -spec win32-g++ -r
Exited with code 0.
Starting: C:/Qt/2010.01/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `X:/Cerulean_'
C:/Qt/2010.01/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `X:/Cerulean_'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.01\qt\include\QtCore" -I"c:\Qt\2010.01\qt\include\QtGui" -I"c:\Qt\2010.01\qt\include\QtOpenGL" -I"c:\Qt\2010.01\qt\include" -I"c:\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"c:\Qt\2010.01\qt\mkspecs\win32-g++" -o debug\physicsLib.o Core\physicsLib.cpp
mingw32-make[1]: Leaving directory `X:/Cerulean_'
mingw32-make: Leaving directory `X:/Cerulean_'

In file included from Core\physicsLib.cpp:25:
Core\/physicsLib.h:29:26: error: Core/element.h: No such file or directory
Core\/physicsLib.h:30:29: error: Core/parameters.h: No such file or directory
Core\/physicsLib.h:31:31: error: Core/smartPointer.h: No such file or directory
Core\/physicsLib.h:33:41: error: Relationships/relationships.h: No such file or directory
Core\/physicsLib.h:34:34: error: Relationships/oneWay.h: No such file or directory
Core\/physicsLib.h:35:34: error: Relationships/twoWay.h: No such file or directory
Core\/physicsLib.h:36:31: error: Relationships/hit.h: No such file or directory
Core\/physicsLib.h:38:37: error: Callbacks/elementDrawer.h: No such file or directory
Core\/physicsLib.h:39:38: error: Callbacks/elementUpdater.h: No such file or directory
... followed by more errors relating to these above includ errors.

In the *.pro file I have:
QT += opengl
SOURCES += main.cpp \
mainwindow.cpp \
glwidget.cpp \
Core/smartPointer.cpp \
Core/physicsLib.cpp \
Core/physics.cpp \
Core/element.cpp \
Core/boundingBox.cpp
HEADERS += glwidget.h \
mainwindow.h \
Core/utilities.h \
Core/smartPointer.h \
Core/physicsLib.h \
Core/parameters.h \
Core/element.h \
Core/boundingBox.h \
Callbacks/elementUpdater.h \
Callbacks/elementDrawer.h \
Relationships/types.h \
Relationships/twoWay.h \
Relationships/relationships.h \
Relationships/oneWay.h \
Relationships/hit.h

I'm not sure why these files aren't being recognized: I know it's probably just a simple linking error... any advice would be appriciated. Thank you.

Lykurg
16th February 2010, 16:41
in Core/physicsLib.h you have to write
#include "element.h"not
#include "Core/element.h"etc.

ETweedale
16th February 2010, 17:36
I tried that and the same errors occured.

Any other suggestions?

Lykurg
16th February 2010, 17:41
try to use an explicit INCLUDEPATH in your pro file.

ETweedale
17th February 2010, 10:52
I added
INCLUDEPATH += -I"x:\Cerulean_\Core\element.h" and so on... to the .pro file but still get the same error:

Core/element.h: No such file or directory

I haven't done any explicit INCLUDEPATH before so I'm not sure if I got it right yet and couldn't tell from the online help stating:

-I <string> ........ Add an explicit include path.

Thanks for your help.