PDA

View Full Version : Compiling problems from XCode using the xcodeproj file as generated by qmake



mcsergiu
28th April 2010, 10:37
Hi guys,

I need help from you. I used gmake -macx filename.pro command to generate the .xcodeproj file. After opening this file in Xcode and compiling the C++ sources files, I've got thousands of errors related to C/C++ standard code and Qt included headers.
I have the impression that the code is considered by xcode as C code not C++ since the errors are related to the string.h interpretation, the public class statement is not known, "using namespace" statements not known , etc.
If generating the Makefile and compiling the source code with make command from command line, everything works fine.
Could you please tell me what should I add to the pro file (preferably) or in XCode to get rid of those errors related to C/C++ standard code?
Please note that if creating a new project in XCode, there I have the possibility to specify the project type (i.e C++ standard application) and the code added there is compiled well.
I have the above mentioned problem only with the xcodeproj files generated with qmake.

Thanks in advance for your help!

mcsergiu
28th April 2010, 13:01
I finally managed to fix the issue. It was caused by the PRECOMPILED_HEADER statement in the .pro file.
Have a good day!

fabietto
28th April 2010, 13:02
I've never experienced this issue before. By the way, within the .pro file you can manually specify the C++ compiler you want to be used by Xcode by default, using the parameter QMAKE_CXX. Here a standard .pro file I use for most of my projects developed on Mac OS:


TEMPLATE = app
TARGET =
DEPENDPATH += .

# Compiler to be used
QMAKE_CXX = g++-4.2

# Application configuration
CONFIG += qt warn_off release x86_64 x86

# Application icon
ICON = icon.icns

# OpenGL and XML Qt Frameworks
QT += opengl
QT += xml

# MacOS/Linux
macx {

# Libraries
INCLUDEPATH += /usr/local/include/
LIBS += /usr/local/lib/libnnfw.a
#LIBS += -lIrrlicht
LIBS += /usr/local/lib/libIrrlicht.a

# Frameworks
LIBS += -framework Carbon
LIBS += -framework Cocoa

}

# Windows
win32 {

# Libraries
INCLUDEPATH += "C:\nnfw-1.1.5-src\include"
INCLUDEPATH += "C:\irrlicht-1.7.1\include"
LIBS += "C:\nnfw-1.1.5-src\lib\Release\nnfw.lib"
LIBS += "C:\irrlicht-1.7.1\lib\Win32-visualstudio\Irrlicht.lib"

}

# Input files
SOURCES += main.cpp \
simulatorEngine.cpp \
team.cpp \
mav.cpp \
nn.cpp \
target.cpp \
irrlichtGUI.cpp \
eventReceiver.cpp

HEADERS += simulatorEngine.h \
team.h \
mav.h \
nn.h \
target.h \
simulationParameters.h \
irrlichtGUI.h \
eventReceiver.h

mcsergiu
29th April 2010, 13:45
Thanks for your answer.
BTW, have you ever mixed cpp files with m files in the same .pro file?
I have such a case, and the xcodeproj file give an error about the "Qt Preprocessors" script (something related to "No rule to make target '../folder/myfile.h' ").

The error in xcodeproj looks like this:
c -D_DEBUG -DUNICODE ... -I/usr/llocal/Qt4.6/....

Make: c: No such file or directory

Does this mean something for you?

Thanks.

mcsergiu
3rd May 2010, 08:39
I found meanwhile that is a bug logged already on this issue at the Qt Team:
http://bugreports.qt.nokia.com/browse/QTBUG-7953

Have a good day!