Qt Creator Error - qt

Launching debugging for a project and then,
Running build steps for project Text_Editor...
Starting: "c:/qt/2010.05/qt/bin/qmake.exe" C:/Qt/2010.05/Text_Editor/Text_Editor.pro -r -spec win32-g++
The process "c:/qt/2010.05/qt/bin/qmake.exe" exited normally.
Starting: "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'
C:/Qt/2010.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Qt/2010.05/Text_Editor-build-desktop'
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"..\qt\include\QtCore" -I"..\qt\include\QtGui" -I"..\qt\include" -I"..\qt\include\ActiveQt" -I"debug" -I"..\Text_Editor" -I"." -I"..\qt\mkspecs\win32-g++" -o debug\main.o ..\Text_Editor\main.cpp
mingw32-make[1]: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'
mingw32-make: Leaving directory `C:/Qt/2010.05/Text_Editor-build-desktop'
g++: ..\Text_Editor\main.cpp: No such file or directory
g++: no input files
mingw32-make[1]: *** [debug/main.o] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project Text_Editor (target: Desktop)
When executing build step 'Make'
I have no clue on that. I just installed it, created a new project and got that error instantly.

I had pretty much the same problem just now.
Without getting into "why" - I unticked "Shadow build" from project options and my build was succesful. Funny part is - "Shadow build" worked yesterday, and nothing really changed that much in between.

For reason or another it is not able to find your main.cpp (g++: ..\Text_Editor\main.cpp: No such file or directory). Basically that path should be ok if you have shadow build toggled on.
Location where the main.cpp is tried to find is:
C:/Qt/2010.05/Text_Editor/main.cpp
Double check that this is proper location (notice also case sensitivity to be sure)
you can try toggling off the shadow build from project -> check off shadow build. And also you should check that Text_Editor.pro contains properly the main.cpp.
Edit: It might be also wise to create that project outside the Qt binary folder, to some other more logical folder.

Try to change your build directory from C:/Qt/2010.05/Text_Editor-build-desktop to C:/Qt/2010.05/Text_Editor.
To do this just open your project in Qt creator, left click on Project on the left pane, then open build settings tab and edit Build directory input field.

What worked for me was the way I added headers in a .pri.
This works...
HEADERS += ../serialportwidget.h
HEADERS += ../serialportworker.h
SOURCES += ../serialportwidget.cpp
SOURCES += ../serialportworker.cpp
or this
HEADERS += ../serialportwidget.h \
../serialportworker.h
SOURCES += ../serialportwidget.cpp \
../serialportworker.cpp
This doesn't...
HEADERS += ../serialportwidget.h \ ../serialportworker.h
SOURCES += ../serialportwidget.cpp \ ../serialportworker.cpp

Run Qt Creator with "Run as Administrator".
Problem Solved for [debug/main.o] error5
-
Vivin NL

Related

Error linking static boost_filesystem library with Qt Creator

I am getting an error when trying to link a static boost_filesystem library with QMake.
I know that my boost install is working, because I can link to it no problem outside of QMake like this:
g++ -o my_file my_file.cpp -IC:\boost_1_55_0\boost_1_55_0 -LC:\boost_1_55_0\boost_1_55_0\stage\lib -lboost_system -lboost_filesystem
I tried linking Qt with boost_filesystem like this at first, but it seems that it could not find the libraries:
LIBS += -LC:\boost_1_55_0\boost_1_55_0\stage\lib -lboost_system -lboost_filesystem
"-lboost_system not found -lboost_filesystem not found"
I read something about how you need to specify absolute paths to static libs when using QMake, so I've changes my LIBS line in my .pro to the following:
LIBS += "C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_system-mgw48-mt-1_55.a" \
"C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_filesystem-mgw48-mt-1_55.a"
The libraries are found with this method, however I get the following error message:
undefined reference to boost::system::generic_category()
I was under the impression that this error only happen when boost_system isn't linked! I seems like it is linked though, because it finds the proper library for it, and I know my install of boost is good because the same library links fine (with the same compiler) outside of Qt Creator.
Here's the include in mainwindow.h:
include <boost/filesystem.hpp>
Here the full .pro:
QT += core gui
QT += network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
QMAKE_CXXFLAGS += -std=c++11
TARGET = Downloader
TEMPLATE = app
INCLUDEPATH += C:\boost_1_55_0\boost_1_55_0
LIBS += "C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_system-mgw48-mt-1_55.a" \
"C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_filesystem-mgw48-mt-1_55.a"
SOURCES += main.cpp\
mainwindow.cpp\
rar_process.cpp\
HEADERS += mainwindow.h\
rar_process.h\
FORMS += mainwindow.ui
RESOURCES += \
graphics.qrc
And here's the full compiler output:
C:\Qt\Qt5.1.1\5.1.1\mingw48_32\bin\qmake.exe -spec win32-g++ -o Makefile ..\qt- downloader\Downloader.pro
C:/Qt/Qt5.1.1/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/Patrick/Desktop/cpp/build-Downloader- Desktop_Qt_5_1_1_MinGW_32bit-Release'
g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release\Downloader.exe release/main.o release/mainwindow.o release/rar_process.o release/qrc_graphics.o release/moc_mainwindow.o release/moc_rar_process.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmain C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_system-mgw48-mt-1_55.a C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_filesystem-mgw48-mt-1_55.a - LC:\Qt\Qt5.1.1\5.1.1\mingw48_32\lib -lQt5Widgets -lQt5Network -lQt5Gui -lQt5Core
release/main.o:main.cpp:(.text.startup+0x1a): undefined reference to `boost::system::generic_category()'
release/main.o:main.cpp:(.text.startup+0x24): undefined reference to `boost::system::generic_category()'
Makefile.Release:86: recipe for target 'release\Downloader.exe' failed
c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686- w64-mingw32/bin/ld.exe: release/main.o: bad reloc address 0x24 in section `.text.startup'
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [release\Downloader.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/Patrick/Desktop/cpp/build-Downloader- Desktop_Qt_5_1_1_MinGW_32bit-Release'
makefile:34: recipe for target 'release' failed
GCC is very sensitive to the order in which you specify libraries during the linking stage. For example, if libA.a depends on libB.a and an executable App depends on both, then you'd have to invoke linker in the following way:
gcc main.o object1.o ... object2.o -lA -lB -o App
This implies that you have to change it to:
LIBS += "C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_filesystem-mgw48-mt-1_55.a" \
"C:\boost_1_55_0\boost_1_55_0\stage\lib\libboost_system-mgw48-mt-1_55.a"
To be cross-platform, it's recommended to make your build more robust:
Boost_VERSION = 1_55
COMPILER = mgw48
win32-g++* {
LIBS += $$(Boost_DIR)/stage/lib/libboost_filesystem-$${COMPILER}-mt-$${Boost_VERSION}.a \
$$(Boost_DIR)/stage/lib/libboost_system-$${COMPILER}-mt-$${Boost_VERSION}.a
PRE_TARGETDEPS += $$(Boost_DIR)/stage/lib/libboost_filesystem-$${COMPILER}-mt-$${Boost_VERSION}.a \
$$(Boost_DIR)/stage/lib/libboost_system-$${COMPILER}-mt-$${Boost_VERSION}.a
}
linux-g++* {
LIBS += -L$$(Boost_DIR)/stage/lib -lboost_filesystem-$${COMPILER}-mt-$${Boost_VERSION} \
-lboost_system-$${COMPILER}-mt-$${Boost_VERSION}
PRE_TARGETDEPS += $$(Boost_DIR)/stage/lib/libboost_filesystem-$${COMPILER}-mt-$${Boost_VERSION}.a \
$$(Boost_DIR)/stage/lib/libboost_system-$${COMPILER}-mt-$${Boost_VERSION}.a
}
NOTE: Boost_DIR would be treated as an environment variable here. So that you can flexibly build it on any system without hardcoding the system-dependent path to Boost. This is general practice in professional software development: try to hardcode as little as possible in your build system, whatever it is. Furthermore, it's reasonable to even make Boost_VERSION environment variable too. All you'd have to change then, are brackets to parentheses, i.e. $${Boost_VERSION} to $$(Boost_VERSION).
Finally, notice that I've used forward slash / as a path separator for both Windows and Linux. Backward slash \ is not only deprecated in QMake, but it is also discouraged in general. Once again, be cross-platform: simply let QMake handle the conversion.
Apparently boost-system will not link against mingw gcc 4.8.0 if it was built with mingw gcc 4.8.1.
I re-built boost with mingw gcc 4.8.0 and linked against those libs, and now it works!

Problems compiling GCC-CilkPlus 4.9

I am trying to compile, on my x86_64 RHEL machine (CentOS 6.4), the GCC compiler with Intel CilkPlus (v4.9) module for compiling applications targeting parallel multicore platforms.
I am following GNU GCC Doc for installation which is very very similar for the GCC with CilkPlus extension. I was particularly focused on providing good attention to the Prerequisites and Configuration sections of the before-mentioned doc.
1) Download
I did download everything I needed using this snapshot as specified in the Instructions page. Download was successful and un-tar as well. I did rename the folder as cilkplus-gcc and put it under my $HOME directory.
I also created another directory: $HOME/b-gcc from where I intend to run the configure command and then make commands. This will prevent from installing into the same directory (something undesirable for this procedure which encourages building everything on a different directory).
2) Initial configuration
As specified in the documentation, I moved into the $HOME/cilkplus-gcc/contrib directory in order to build the three most important libraries needed by the installation process (that is: compiling GCC):
GMP: located into the $HOME/cilkplus-gcc/contrib/gmp-4.3.2 directory.
MPFR: located into the $HOME/cilkplus-gcc/contrib/mpfr-2.4.2 directory.
MPC: located into the $HOME/cilkplus-gcc/contrib/mpc-0.8.1 directory.
I build them in the order of appearance as MPFR depends on GMP and MPC depends on both GMP and MPFR. I wanted to place ll needed files into the $HOME/cilkplus-gcc directory so I instructed the installers of these libraries to place everything into the $HOME/cilkplus-gcc/contrib/tmp directory. So:
sudo $HOME/cilkplus-gcc/contrib/gmp-4.3.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpfr-2.4.2/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp
sudo $HOME/cilkplus-gcc/contrib/mpc-0.8.1/configure --enable-shared --enable-static --prefix=$HOME/cilkplus-gcc/contrib/tmp --with-gmp=$HOME/cilkplus-gcc/contrib/tmp --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp
As direct result, my $HOME/cilkplus-gcc/contrib/tmp directory is filled with directories lib, include, share and bin with those three libs inside.
3) Installation
Time to get busy compiling everything. I move into the $HOME/b-gcc directory and from there I issue the following command:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/
The configuration goes smoothly and creates make stuff into my current folder ($HOME/b-gcc). Time to make and I issue: sudo make.
Two minutes and I get this error
g++ -c -g -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -fno-common -DHAVE_CONFIG_H -I. -Ic-family -I/home/andry/cilkplus-gcc/gcc -I/home/andry/cilkplus-gcc/gcc/c-family -I/home/andry/cilkplus-gcc/gcc/../include -I/home/andry/cilkplus-gcc/gcc/../libcpp/include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/contrib/tmp//include -I/home/andry/cilkplus-gcc/gcc/../libdecnumber -I/home/andry/cilkplus-gcc/gcc/../libdecnumber/bid -I../libdecnumber -I/home/andry/cilkplus-gcc/gcc/../libbacktrace /home/andry/cilkplus-gcc/gcc/c-family/cppspec.c -o
c-family/cppspec.o g++ -g -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -o cpp gcc.o ggc-none.o \ c-family/cppspec.o driver-i386.o libcommon-target.a \
libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a /home/andry/b-gcc/./gcc/xgcc
-B/home/andry/b-gcc/./gcc/ -dumpspecs > tmp-specs /home/andry/b-gcc/./gcc/xgcc: error while loading shared libraries:
libiconv.so.2: cannot open shared object file: No such file or
directory make3: * [specs] Error 127 make3: Leaving directory
/home/andry/b-gcc/gcc' make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory/home/andry/b-gcc' make1: *
[stage1-bubble] Error 2 make1: Leaving directory
`/home/andry/b-gcc'
But I check my /usr/local/lib folder and I can clearly see that libiconv.so.2 is there! So I understand the installation procedure (that is GCC compiling itself) cannot find the library (clearly referenced as I can see the -liconv flag). So I delete everything in $HOME/b-gcc and issue a modified configure command:
sudo $HOME/cilkplus-gcc/configure --prefix=$HOME/cilkplus-install --enable-languages="c,c++" --with-gmp=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpfr=$HOME/cilkplus-gcc/contrib/tmp/ --with-mpc=$HOME/cilkplus-gcc/contrib/tmp/ --with-stage1-ldflags=-L/usr/local/lib
As I issue sudo make again, the previous error is not encountered anymore and time passes. After 5/6 minutes I get this error:
checking for x86_64-unknown-linux-gnu-ar... ar checking for
x86_64-unknown-linux-gnu-lipo... lipo checking for
x86_64-unknown-linux-gnu-nm... /home/andry/b-gcc/./gcc/nm checking
for x86_64-unknown-linux-gnu-ranlib... ranlib checking for
x86_64-unknown-linux-gnu-strip... strip checking whether ln -s
works... yes checking for x86_64-unknown-linux-gnu-gcc...
/home/andry/b-gcc/./gcc/xgcc -B/home/andry/b-gcc/./gcc/
-B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/bin/ -B/home/andry/cilkplus-install/x86_64-unknown-linux-gnu/lib/ -isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/include
-isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
checking for suffix of object files... configure: error: in
/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc': configure:
error: cannot compute suffix of object files: cannot compile See
config.log' for more details. make2: *
[configure-stage1-target-libgcc] Error 1 make2: Leaving directory
/home/andry/b-gcc' make[1]: *** [stage1-bubble] Error 2 make[1]:
Leaving directory/home/andry/b-gcc'
Well, quite a strange stuff... So I checked $HOME/b-gcc/x86_64-unknown-linux-gnu/libgcc/config.log (gonna show the relevant excerpt):
-isystem /home/andry/cilkplus-install/x86_64-unknown-linux-gnu/sys-include
-c -g -O2 conftest.c >&5 /home/andry/b-gcc/./gcc/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file:
No such file or directory configure:3593: $? = 1 configure: failed
program was: | /* confdefs.h */ | #define PACKAGE_NAME "GNU C Runtime
Library" | #define PACKAGE_TARNAME "libgcc" | #define PACKAGE_VERSION
"1.0" | #define PACKAGE_STRING "GNU C Runtime Library 1.0" | #define
PACKAGE_BUGREPORT "" | #define PACKAGE_URL
"http://www.gnu.org/software/libgcc/" | /* end confdefs.h. */ | |
int | main () | { | | ; | return 0; | } configure:3607: error: in
/home/andry/b-gcc/x86_64-unknown-linux-gnu/libgcc':
configure:3610: error: cannot compute suffix of object files: cannot
compile Seeconfig.log' for more details.
Saying that the error is basically the following:
/home/andry/b-gcc/./gcc/cc1: error while loading shared libraries:
libmpc.so.2: cannot open shared object file: No such file or directory
But didn't I already told it (during configure) to go search for libmpc.so.2 into $HOME/cilkplus-gcc/contrib/tmp???
How can I get things done?
How can I get through this? Thankyou
**
I downloaded the snapshot of the cilkplus branch from http://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/heads/cilkplus-4_8-branch and click the snapshot link on the top line of the list of checkins. It will take a few moments for the server to fetch the sources and build a compressed tarfile. Once the compressed tarfile has downloaded, unpack it using the following commands after placing it in directory /home :
cd /home
tar -xf gcc-3cfca5e.tar.gz
This creates a directory gcc-3cfca5e
Download latest mpfr, mpc and gmp and place these tarballs into the gcc-3fca5e directory.
cd /home/gcc-3cfca5e
tar -jxvf mpfr-3.1.2.tar.bz2
tar -xzvf mpc-1.0.1.tar.gz
tar -vxjf gmp-5.1.3.tar.bz2
ln -sf mpfr-3.1.2 mpfr
ln -sf mpc-1.0.1 mpc
ln -sf gmp-5.1.3 gmp
cd /home
mkdir gcc-cilk-obj
mkdir gcc-cilk
cd /home/gcc-cilk-obj
../gcc-3cfca5e/configure --prefix=/home/gcc-cilk --disable-multilib -enable-languages=c
make
make install
============
It took about 4 hours to make on a core 2 duo running Slackware current inside VirtualBox 4
(VBox settings>system>processor> check enable PAE) Windows 7 professional. My linux system did not have autogen but it worked anyway.

How to solve undefined reference errors when linking log4cxx in qmake project

It's the second day I'm trying to marry Qt5, MinGW and log4cxx.
Even after I've compiled everything successfully, linked apr, apr-util and log4cxx libraries, ld gives me a bunch of "undefined reference" problems.
It looks like different settings were specified during log4cxx compilation (I'm using ant).
Was anyone able to successfully compile and use log4cxx with MinGW?
Environment:
log4cxx trunk
apr 1.4.6
apr-util 1.5.2
latest MinGW
I'm using Qt 5 with latest MinGW as a compiler
What I've done:
compiled log4cxx using ant with the following command: "ant
-Dcompiler=gcc -Dfind=false -DLOG4CXX_STATIC=1 -Dlib.type=static"
added result libraries to my project in pro file: "LIBS +=
-L../log4cxx/lib LIBS += -llibapr-1 -llibaprutil-1 -lliblog4cxx"
And now, as I try to link my project, I'm getting the next:
*C:/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Work/SPP_Development/AutoHaul/Sub-systems/TCS/Source/build-SimulatorEngine-Standalone_MinGW-Debug'
g++ -Wl,-subsystem,windows -mthreads -o debug\SimulatorEngine.exe object_script.SimulatorEngine.Debug -lmingw32 -lqtmaind -L../log4cxx/lib -llibapr-1 -llibaprutil-1 -lliblog4cxx -LC:\Qt\Qt5.0.1\5.0.1\mingw47_32\lib -lQt5XmlPatternsd -lQt5Widgetsd -lQt5Networkd -lQt5Xmld -lQt5Guid -lQt5Cored -llibEGLd -llibGLESv2d -lgdi32 -luser32
Makefile.Debug:200: recipe for target 'debug\SimulatorEngine.exe' failed
mingw32-make[1]: Leaving directory 'C:/Work/SPP_Development/AutoHaul/Sub-systems/TCS/Source/build-SimulatorEngine-Standalone_MinGW-Debug'
Makefile:34: recipe for target 'debug' failed
../log4cxx/lib/liblog4cxx.lib(mutex.o): In function `ZN7log4cxx7helpers5MutexC2ERNS0_4PoolE':
c:/Work/log4cxx/apache-log4cxx-trunc/src/main/cpp/mutex.cpp:35: undefined reference to `apr_thread_mutex_create#12'
../log4cxx/lib/liblog4cxx.lib(mutex.o): In function `ZN7log4cxx7helpers5MutexC2EP10apr_pool_t':
c:/Work/log4cxx/apache-log4cxx-trunc/src/main/cpp/mutex.cpp:45: undefined reference to `apr_thread_mutex_create#12'
../log4cxx/lib/liblog4cxx.lib(mutex.o): In function `ZN7log4cxx7helpers5MutexD2Ev':
c:/Work/log4cxx/apache-log4cxx-trunc/src/main/cpp/mutex.cpp:55: undefined reference to `apr_thread_mutex_destroy#4'*
It looks like log4cxx library cannot findfunctions declared and defined in the apr library by whatever reason.
Is there any way to analyze the problem further to see why is this happening?
I will describe the 1st problem you have and give the solution for it. If it does not solve your problem, do not revert back because that would be just the 1st step of fixing process, and I will gradually expand the answer to solve more incoming issues as long as you provide relevant feedback on each fix until we finally nail it down. So, lets begin.
First of all, you add libraries into LIBS variable in a wrong way. You have 2 options to do it right:
#1
LIBS += $${PWD}/../log4cxx/lib/libapr-1.a
LIBS += $${PWD}/../log4cxx/lib/libaprutil-1.a
LIBS += $${PWD}/../log4cxx/lib/liblog4cxx-1.a
#2
LIBS += -L$${PWD}/../log4cxx/lib
LIBS += -lapr-1
LIBS += -laprutil-1
LIBS += -llog4cxx-1
NOTE: Of course one liner is possible too:
LIBS += -L$${PWD}/../log4cxx/lib -lapr-1 -laprutil-1 -llog4cxx-1
NOTE: Using line continuation (\) for readability is possible too:
LIBS += -L$${PWD}/../log4cxx/lib \
-lapr-1 \
-laprutil-1 \
-llog4cxx-1
You need to take care of the proper link order: liblog4cxx depends on libapr*, so the libapr entries need to come after liblog4cxx:
LIBS += -L../log4cxx/lib \
-llog4cxx-1 \
-lapr-1 \
-laprutil-1
The reason is that dependencies are resolved left to right, so that in your case the apr libraries have been read, and forgotten, when log4cxx comes along that has some external symbols that need resolving. ld won't read the apr libraries again (has to do with cyclic dependency issues, and historical reasons).
To test if this works, you can try running the command
g++ -Wl,-subsystem,windows -mthreads -o debug\SimulatorEngine.exe object_script.SimulatorEngine.Debug -lmingw32 -lqtmaind -L../log4cxx/lib -lliblog4cxx -llibapr-1 -llibaprutil-1 -LC:\Qt\Qt5.0.1\5.0.1\mingw47_32\lib -lQt5XmlPatternsd -lQt5Widgetsd -lQt5Networkd -lQt5Xmld -lQt5Guid -lQt5Cored -llibEGLd -llibGLESv2d -lgdi32 -luser32
from the directory
C:/Work/SPP_Development/AutoHaul/Sub-systems/TCS/Source/build-SimulatorEngine-Standalone_MinGW-Debug
yourself first. But perhaps just modifying the .pro file is simplest.

How to compile a Qt application through the command line with MinGW?

I have downloaded the latest Qt version for MinGW, and I have the correct MinGW version which is compatible with Qt. When I try to make the project, g++ is unable to find my source file even if it's in the same folder as the project file.
Those are the steps I followed (all project and source files are in T:\QtTest ):
T:\QtTest> qmake -project
T:\QtTest> qmake
T:\QtTest> make
And the output is this:
T:\QtTest> make
mingw32-make -f Makefile.Debug
mingw32-make1: Entering directory `T:/QtTest’
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I“c:\Qt\4.8.0\include\QtCore” -I“c:\Qt\4.8.0\include\QtGui” -I“c:\Qt\4.8.0\include” -I”.” -I“c:\Qt\4.8.0\include\ActiveQt” -I“debug” -I“c:\Qt\4.8.0\mkspecs\default” -o debug\main.o main.cpp
g++: main.cpp: no such file or directory
g++: no input files
mingw32-make1: *** [debug/main.o] Error 1
mingw32-make1: Leaving directory `T:/QtTest’
mingw32-make: *** [debug] Error 2
I have no idea why it can't find "main.cpp" file when it's in the same directory as the
project files. Even if I replace "main.cpp" with the full path ("T:\QtTest\main.cpp") it still won't find it. What am I doing wrong?
The following is my project structure:
(main.cpp is the only file that I wrote, all the others were generated by qmake)
T:\QtTest\main.cpp
T:\QtTest\Makefile
T:\QtTest\Makefile.debug
T:\QtTest\Makefile.release
T:\QtTest\QtTest.pro
T:\QtTest\debug\
T:\QtTest\release\
My g++ version is 4.4.0, which is the version suggested by the Qt installer and available for download in the same page as the Qt for MinGW installer.
Problem solved.
It had nothing to do with MinGW or Qt or the makefiles generated by qmake. I found it was caused solely by a custom entry in the Windows registry. I'm posting this solution for anyone who encounters the same problem:
Sometime ago I had created an entry in the Windows registry under HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor called Autorun, which makes CMD.exe start in a custom working directory, which was something I wanted to do (so I followed the steps detailed in this page about "How to change the default startup directory for Command Prompt": http://windowsxp.mvps.org/autoruncmd.htm).
Well, I completely neglected the CAUTION part in that page, which states that "Changing the current directory using Autorun value as mentioned in this article, might affect the functionality of batch scripts". Yes, shame on me.
So, if you have the same problem of being unable to make your Qt projects using qmake, and everything else looks OK in your project structure and makefiles, verify that you don't have something in the Windows registry which might change the startup directory for the command prompt.
Do you have MSYS installed? If sh.exe from MSYS is on the system path, it may conflict with the interpretation of windows style paths. Check the documentation here.
If that isn't the problem, then delete everything in your project folder except the source files and start over again with qmake -project. After that step, open the .pro file and verify that things look correct. For a very basic project, I get something like this:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += widget.h
FORMS += widget.ui
SOURCES += main.cpp widget.cpp
The next two steps, running qmake and then make should work correctly. If not, there is nothing wrong with the steps you followed and there is something wrong with your system/environment.

an error in qt_creator

I begin to study qt (I have qt creator, last version), so I read the reference how to begin to work with it and I'm trying to compile project "Animated Tiles" but I receive an error, can somebody please explain why:
Running build steps for project animatedtiles...
Configuration unchanged, skipping qmake step.
Starting: "D:/QT_prog/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: Nothing to be done for `all'.
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\release_shared" -I"..\animatedtiles" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o ..\animatedtiles\main.cpp
..\animatedtiles\main.cpp:257:20: error: main.moc: No such file or directory
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
mingw32-make: *** [release-all] Error 2
The process "D:/QT_prog/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project animatedtiles (target: Desktop)
When executing build step 'Сборка'
Looks like the main.moc file hasn't be generated.
Try this:
Clean the Project "Build" -> "Clean All" or "Clean Project "
Build the project again, Ctrl+B
If that doesn't work then:
Comment out the #include "main.moc" line at the end of main.cpp
Perform a build, moc should run and create main.moc, but the build will fail.
Uncomment #include "main.moc", and build again. Should work
Edit:
I'm not very familiar with qt creator, so you might also want to try just remove the #include "main.moc" line altogether. QMake might be smart enough and figure out what to do.
The suggested solution did not work for me. I had to copy main.moc from release_shared up to the directory containing main.cpp. QT 2010.05, Win7.
I think you are experiencing this:
http://bugreports.qt.io/browse/QTCREATORBUG-1889
I was able to reproduce this issue with Qt SDK 2010.04.
Install Qt SDK 2010.04 on Windows 7
Open animatedtiles
Build
Removing c:\Qt\2010.04\qt\exmaples\animation\animatedtiles\tmp\moc\release_shared\main.moc manually solved the issue.

Resources