Hi i made a command line tool but when compiling i get this error :
which is rather strange because the file is in the right folder in the project :
I already tried removing it and then adding it again , but it didn't help.
Did i forget to include something etc ... ?
I'm not really familiar with xcode so any help would be greatly appreciated.
You don't need the GL folder.
#include <OpenGL/OpenGL.h>
Within OpenGL.framework is gl.h, glext.h, and whatnot, and it's adapted for mac.
If you insist on GL/gl.h, you need to add it to the project's header search path. To do this, go to your project's settings->build rules, and search "Include Paths". When you find the "Header Include Paths" section, type in "${SRCROOT}/". This assumes that GL/gl.h is in the same project as your folder.
Related
Other answers seem to have some relevant information, but nothing that fixes the problem I'm having.
From my project in Xcode, I chose 'add files to project' and selected the entire glm sub-folder (which I have been told is all you need to use glm). Then, in my main.cpp file, I wrote #include glm.hpp to receive the error glm/glm.hpp file not found from the glm.cpp file.
Has anyone else had this problem? It is supposedly a header-only library, which means I dont have to add any include paths, right?
Update "Header Search Path" in xcode to include your "glm-0.9.5" directory.
Project->Build Settings->Search Paths->Header Search Paths
( In my case, I have added "/Users/me/work/glm-0.9.5" )
I'm trying to include the FTGL library into my graphics project, but I keep getting c1083 error whenever I try to include the main header file:
#include <include/FTGL/ftgl.h>
I have added the path $(Project1)include\FTGL to "Additional Include Directories" and VC++ Include Directories to no avail. Project1 is the main solution folder and "include" is the folder where the headers for glew and whatnot are.
What am I doing wrong? Thanks for the help.
The rules here are very simple. Say you have a file on your hard drive:
C:\abc\def\include\FTGL\ftgl.h
Then you need to add an include path C:\abc\def to your project and the include statement:
#include <include/FTGL/ftgl.h>
This was tested 1000 times. Works fine! Once you will make this working, start experimenting with $(Project1) and other VS variables.
I have imported my project from windows to mac and Is using xcode to compile the project.
I have managed to fix most error and bugs from the porting process but there is one bug/error I am unable to determine why its not working as it should. This probably due to my lack of knowledge of xcode but was wondering if anyone is able to help me with this problem.
The problem is this;
I have a two sub folders in my project, once called include and another called source. Of course include contains all the header files and source contains all the cpp files and such.
Example:
Root/
Include/
Header.h
Source/
test.cpp
Now in the build settings in the xcode project, I have added $(SRCROOT)/Include/ in the Header Serach Paths. So therefore I presume that xcode will include any header files in the Include folder.
So in the test.cpp class I add #include "Header.h". When I click build I get an error saying "'Header.h' file not found".
Im not entirely sure what I am doing wrong, of course I can do this for example - #include "../Include/Header.h" but that's going to be a pain going through all the cpp files in my project (which is a lot).
I was just wondering if anyone else came across this problem?
Thanks for reading.
In general you need to add the headers to the User Header Search Paths, which if you search the help in XCode will give you the format you need to pass the directory as.
I'm using VS2010 (downloaded via dreamspark) and although I can open the #include file by right clicking on it and pressing on Open Document, it complains "Error can not open source file "..."" which seems rather absurd. I'm using Qwt with Qt this time around and I'm specifically having the problem for:
#include <qwt_counter.h>
#include <qwt_plot.h>
(And I am using the "<>"); not sure how to make those appear properly in the code above.
Thanks in advance.
As Neil indicated, try using quotes instead of the <> characters around the filename. When using the quotes, MSVC will look in the same directory as the file the #include is in for the specified file, then if it's not found there will look in the directories specified by the include path. When the filename is surrounded by <> characters, the current file's directory isn't looked at - the compiler goes right to the include path.
See http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx for details.
Note that this is an implementation dependent behavior - it might not apply to other compilers.
If that doesn't help, make sure that your include path contains the directory that the file is located in by setting the "Include Directories" property appropriately:
http://msdn.microsoft.com/en-us/library/t9az1d21.aspx
Finally, you might be using a makefile project (I'm not sure how common it is for Qt projects to continue to use qmake when built from VS) , in which case you'll need to perform whatever configuration is necessary in the make file(s) or parameters passed on the command line that invokes the makefiles.
Is the path where these files are located either the same as that of this source file, or included in the "additional include directories" in your project settings?
Project -> properties -> c/c++ section -> additional include directories.
If they are located in a subdirectory of the source file you're editing or of one of the additional include directories (I think) you can also include them with:
#include <path_to_file_1/qwt_counter.h>
#include <path_to_file_2/qwt_plot.h>
[edit]
or of course what neil says
[/edit]
It turned out there was a circular linking happening and I had all my code in a .h file. I split it up and added the corresponding .cpp file, now everything works fine.
I'm trying to get Xcode to import the header file for Irrlicht.
#include <irrlicht.h>
It says "Irrlicht.h. No such file or directory". Yes Irrlicht.h with a capital I, even though the #include is lowercase.
Anyway I added "/lib/irrlicht-1.6/include" in the header search paths for the Xcode project, yet it still doesn't find it.
The only thing I've tried that does work is:
#include "/lib/irrlicht-1.6/include/irrlicht.h"
This is a bit ridiculous though, #include should work, I don't understand why it isn't working.
Update (here are more details on the error):
/lib/PAL/pal_benchmark/palBenchmark/main.h:31:0
/lib/PAL/pal_benchmark/palBenchmark/main.h:31:22: error: irrlicht.h: No such file or directory
I figured this out. Perhaps someone can comment as to why this is the case.
The Header was located in this directory:
/lib/irrlicht-1.6/include/
If I added that path to: "Header Search Paths" Xcode still wouldn't find the path when I built the project.
Solution: Add the header path to: "User Header Search Paths" instead.
It boggles me why I had to do this, as I frequently add my header paths to "Header Search Paths" and then #includes just work. Hopefully this can help someone else who gets this same issue.
Both
#include <irrlicht.h>
#include "irrlicht.h"
should work as long as the "-I" argument to gcc includes the path of the directory enclosing the header file. If irrlicht.h is part of /usr/include the "-I" option is no longer required.
Rather than explicitly adding include paths to your project settings, an easier and more convenient solution for this kind of situation is to just drag the directory containing your .h files (/lib/irrlicht-1.6/include in this case) into the project files pane. This adds the headers to your project of course, and makes it easy to browse them and search for symbols, etc, and it also adds the directory path to gcc compiles, so that you don't have to manage include paths explicitly.
and furthermore, a flat file hierarchy isn't what you want. Dragging files into Xcode flattens your hierarchy. What about for example when you want to have multiple Targets, with a "TargetName/settings.h" file for that target. you'll have many settings.h files that you need to keep unique via its folder name.
I understand that this is an old post, but it does rank quite high on Google, so I thought I would add some information
Under XCode 3.2.6, I had an issue where XCode could not find a header file. It turns out that one of the filepaths included a space in it, and XCode interpreted it improperly.
For example: With a path like "Users/Username/Desktop/Project/Some Headers"
Here was the excerpt from the GCC Commandline: "-I/Users/Username/Desktop/Project/Some" "-I/Headers"
To see your build log provided by XCode, there is a good tutorial here: How do you show Xcode's build log? (Trying to verify if iPhone distribution build zip was created correctly.)