Problem compiling

This is a discussion on Problem compiling within the C++ Programming forums, part of the General Programming Boards category; Hello all. I am having trouble with my compiler. Its not including a couple of header files which I KNOW ...

  1. #1
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827

    Unhappy Problem compiling

    Hello all.
    I am having trouble with my compiler.
    Its not including a couple of header files which I KNOW is there. Its saying they don't exist.

    (Elaborated more on it below the compiler output)

    Here's the compiler output:
    Running build steps for project TextToSpeechDialog5...
    Starting: E:/Qt/2009.03/qt/bin/qmake.exe E:/Documents and Settings/Gorilla/My Documents/Programming_Projects/EasySSL/Modules/MainWindow_mod/Modules/TTS_mod/modules/TextToSpeechDialog5/TextToSpeechDialog5.pro -spec win32-g++ -r
    Exited with code 0.
    Starting: E:/Qt/2009.03/mingw/bin/mingw32-make.exe -w

    mingw32-make: Entering directory `E:/Documents and Settings/Gorilla/My Documents/Programming_Projects/EasySSL/Modules/MainWindow_mod/Modules/TTS_mod/modules/TextToSpeechDialog5'
    E:/Qt/2009.03/mingw/bin/mingw32-make -f Makefile.Debug
    mingw32-make[1]: Entering directory `E:/Documents and Settings/Gorilla/My Documents/Programming_Projects/EasySSL/Modules/MainWindow_mod/Modules/TTS_mod/modules/TextToSpeechDialog5'
    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"e:\Qt\2009.03\qt\include\QtCore" -I"e:\Qt\2009.03\qt\include\QtGui" -I"e:\Qt\2009.03\qt\include" -I"e:\Qt\2009.03\qt\include\ActiveQt" -I"debug" -I"e:\Qt\2009.03\qt\mkspecs\win32-g++" -o debug\TextToSpeechDialog5.o TextToSpeechDialog5.cpp
    In file included from module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:7,
    from TextToSpeechDialog5.h:4,
    from TextToSpeechDialog5.cpp:5:
    module/CtextToSpeechDialog5/../../../TextToSpeechDialogSuccess/TextToSpeechDialogSuccess.h:4:74: module/CtextToSpeechDialogSuccess/CtextToSpeechDialogSuccess.h: No such file or directory
    In file included from module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:8,
    from TextToSpeechDialog5.h:4,
    from TextToSpeechDialog5.cpp:5:
    module/CtextToSpeechDialog5/../../../TextToSpeechDialogFailure/TextToSpeechDialogFailure.h:4:74: module/CtextToSpeechDialogFailure/CtextToSpeechDialogFailure.h: No such file or directory
    In file included from TextToSpeechDialog5.h:4,
    from TextToSpeechDialog5.cpp:5:
    module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:48: error: ISO C++ forbids declaration of `CtextToSpeechDialogSuccess' with no type
    module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:48: error: expected `;' before '*' token

    module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:49: error: ISO C++ forbids declaration of `CtextToSpeechDialogFailure' with no type
    module/CtextToSpeechDialog5/CtextToSpeechDialog5.h:49: error: expected `;' before '*' token
    mingw32-make[1]: Leaving directory `E:/Documents and Settings/Gorilla/My Documents/Programming_Projects/EasySSL/Modules/MainWindow_mod/Modules/TTS_mod/modules/TextToSpeechDialog5'
    mingw32-make: Leaving directory `E:/Documents and Settings/Gorilla/My Documents/Programming_Projects/EasySSL/Modules/MainWindow_mod/Modules/TTS_mod/modules/TextToSpeechDialog5'
    mingw32-make[1]: *** [debug/TextToSpeechDialog5.o] Error 1
    mingw32-make: *** [debug] Error 2
    Exited with code 2.
    Error while building project TextToSpeechDialog5
    When executing build step 'Make'
    The problem stems from the include lines in header files “TextToSpeechDialogSuccess.h” and “TextToSpeechDialogFailure.h”.

    These lines are as follows:

    For TextToSpeechDialogSuccess.h:
    Code:
    #include “module/CtextToSpeechDialogSuccess/CtextToSpeechDialogSuccess.h”
    For TextToSpeechDialogFailure.h:
    Code:
    #include “module/CtextToSpeechDialogFailure/CtextToSpeechDialogFailure.h”
    The compiler claims these files don't exist at those locations, when in truth of fact, they do. I know, because I have successfully built the executables for both of those dialogs, using their own project files, which use those same headers successfully.

    The directory structure for the TextToSpeechDialogSuccess module is as follows (note that dirs are in bold):

    TextToSpeechDialogSuccess:
    TextToSpeechDialogSuccess.h (includes “CtextToSpeechDialogSuccess.h”)
    TextToSpeechDialogSuccess.cpp (includes “TextToSpeechDialogSuccess.h” and provides the int main() function for the module)
    module:
    CtextToSpeechDialogSuccess:
    CtextToSpeechDialogSuccess.h (has class definition of class CtextToSpeechDialogSuccess)
    CtextToSpeechDialogSuccess.cpp (includes “CtextToSpeechDialogSuccess.h” and provides the definitions for all class methods)

    Similarly, the directory structure for the TextToSpeechDialogFailure module is as follows (note that dirs are in bold):

    TextToSpeechDialogFailure:
    TextToSpeechDialogFailure.h (includes “CtextToSpeechDialogFailure.h”)
    TextToSpeechDialogFailures.cpp (includes “TextToSpeechDialogFailure.h” and provides the int main() function for the module)
    module:
    CtextToSpeechDialogFailure:
    CtextToSpeechDialogFailure.h (has class definition of class CtextToSpeechDialogFailure)
    CtextToSpeechDialogFailure.cpp (includes “CtextToSpeechDialogFailure.h” and provides the definitions for all class methods)

    Now, the module "TextToSpeechDialog5" (the module I'm having trouble compiling) is located in the same directory as the other modules' directories are located in (i.e. a folder called “modules”), and the hierarchy structure is the same as the other two dialog modules. Only difference is, since this dialog needs to create and show the next dialog (the success or failure dialog, depending on the result of the conversion of text to speech), I had to include the other two dialog modules' headers (“TextToSpeechDialogSuccess.h” and “TextToSpeechDialogFailure.h”, which if you can remember, includes the header files of their module's class) in the header of the "TextToSpeechDialog5" module (named appropriately “TextToSpeechDialog5.h”).
    To accomplish this, I used the following two lines in the header file:
    Code:
    #include “../../../TextToSpeechDialogSuccess/TextToSpeechDialogSuccess.h”
    #include “../../../TextToSpeechDialogFailure/TextToSpeechDialogFailure.h”
    The “../” notations simply mean to go up one directory from the current directory, so since I gave that three times, that means look for a directory called “TextToSpeechDialogSuccess” three directories up from the current directory (which is “CtextToSpeechDialog5”), enter it, and include the file located in it called “TextToSpeechDialogSuccess.h” (the second line is almost identical and include's the failure dialog module's header). That worked fine. The problem occurred when the compiler found the line:
    Code:
    #include “module/CtextToSpeechDialogSuccess/CtextToSpeechDialogSuccess.h”
    inside the “TextToSpeechDialogSuccess.h” header file, and the line:

    Code:
    #include “module/CtextToSpeechDialogFailure/CtextToSpeechDialogFailure.h”
    inside the "TextToSpeechDialogFailure.h" header file.
    For some reason, the compiler is unable to include those files, and I don't know why, since they DO exist at that exact same location, because, like I already mentioned, I have already built the “TextToSpeechDialogSuccess” and “TextToSpeechDialogFailure” modules which use those same headers, and they compiled successfully.?? The only thing I can think of is the reason why its doing this is because the compiler can't handle the multiple directory changes for some reason, and so its throwing an error message saying it can't find the files.

    Anyway, I hope someone can come up with a solution for this, because I almost have the GUI for my TTS_mod working, with all dialogs already coded and ready to be compiled, but for some reason the compiler is giving me problems and preventing me from completing it.

    Thanks, and looking forward to a reply.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    The quotes you have in your post are the wrong quotes for code. Instead of “ and ” you should use " and ". Are those other quotes that way in your code, or did they just change when you pasted your includes here? If they are the wrong quotes in code, just delete the quotes and re-type them all. The proper quotes are used when you type in your editor, but if you paste from a text editor they sometimes paste the fancier text versions.

  3. #3
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by Daved View Post
    The quotes you have in your post are the wrong quotes for code. Instead of “ and ” you should use " and ". Are those other quotes that way in your code, or did they just change when you pasted your includes here?
    They just pasted that way. The quotes I used are the standard "".
    If they are the wrong quotes in code, just delete the quotes and re-type them all. The proper quotes are used when you type in your editor, but if you paste from a text editor they sometimes paste the fancier text versions.
    Yep, that's what happened, though actually I pasted them from a OpenOffice document.

  4. #4
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,789
    Probably the directory structure indicated within the problem headers don't exist relative the current path (the current working directory) of the project being compiled even though they do exist when viewed/compiled independently... if that makes sense (I know what I mean to say but not necessarily describe it without some overly complex example). Add the folder/directory locations where the headers exist as arguments to the compiler and you won't have to worry about what directories are indicated in the source/headers... probably it's similar to those -I arguments you've got listed above.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  5. #5
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by hk_mp5kpdw View Post
    Add the folder/directory locations where the headers exist as arguments to the compiler and you won't have to worry about what directories are indicated in the source/headers... probably it's similar to those -I arguments you've got listed above.
    Well, considering that QT Creator handles all of the compiler stuff by itself, I'm not sure exactly how to do that. I do know QT Creator uses .pro (project) files in which are specified all of the headers and source files of the project.
    It seems that the compiler QT uses on Windows is mingw32-make.exe. But it first uses a make tool called "qmake". You can pass all sorts of arguments to qmake if you start it on the command line, but I tried using it in Linux that way, and wasn't able to. I haven't tried it in Windows XP yet though, which is where I'm currently working on the project, but I suppose I'll have to. I understand qmake generates a makefile which the compiler then uses as the instructions on how to build it, but I guess I'll have to read all of their documentation on qmake before I understand how to do it...

    And anyway, I thought "" in #include directives means the "current directory" which translates to the current directory of the current file?? If that's the case, why doesn't it work?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem compiling simple code examples
    By Wintersun in forum Windows Programming
    Replies: 8
    Last Post: 08-14-2007, 10:30 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. compiling problem
    By tinkerbell20 in forum C++ Programming
    Replies: 6
    Last Post: 06-21-2005, 12:12 PM
  5. simple compiling problem
    By waxydock in forum C++ Programming
    Replies: 2
    Last Post: 03-26-2005, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21