Re: Compilation failures using qmake + mingw / msvc
Lorenzo Bettini <[email protected]> Thu, 19 Nov 2009 00:30:00 +0100
| Newsgroups | gmane.comp.gnu.source-highlight.general |
|---|---|
| Message-ID | <[email protected]> |
Lorenzo Bettini wrote:
> Matthias Pospiech wrote:
>> Lorenzo Bettini schrieb:
>>> Matthias Pospiech wrote:
>>>> Lorenzo Bettini schrieb:
>>>>> Matthias Pospiech wrote:
>>>>>> Lorenzo Bettini schrieb:
>>>>>>>
>>>>>>> P.S. it looks like building boost with msvc is fully supported:
>>>>>>> http://www.boost.org/doc/libs/1_41_0/more/getting_started/windows.html
>>>>>>>
>>>>>>>
>>>>>> building boost is not a problem, I have a problem to tell qmake
>>>>>> where the include files are, since it does not find them.
>>>>>
>>>>> you should pass to qmake these options
>>>>>
>>>>> INCPATH+="/usr/local/include" LIBS+="-L/usr/local/lib -lboost_regex"
>>>>>
>>>> I am not using linux, so it reads
>>>>
>>>> debug: LIBS += -Llib/boost/regex/mingw/debug
>>>> -lboost_regex-mgw34-mt-d-1_40
>>>> release:LIBS += -Llib/boost/regex/mingw/release
>>>> -lboost_regex-mgw34-mt-1_40
>>>>
>>>
>>> yes, it's the same, I just meant that instead of polluting the .pro
>>> file you can pass these options to qmake at the command line :)
>>>
>>>> note that I copy the library file to a new location, because the
>>>> compilation destination path of boost is very strange.
>>>>
>>>> The include is added via
>>>>
>>>> INCLUDEPATH += ../boost_1_40_0
>>>>
>>>> or the full path. However during compilation the boost library
>>>> headers are not found.
>>>
>>> you have to put in the INCLUDEPATH (which I usually write as INCPATH,
>>> are you sure it's the same?) the path where the boost subdirectory is.
>>>
>>> For instance, if regex.hpp is in
>>>
>>> /my/path/boost_1_40_0/include/boost
>>>
>>> then you need to specify as include path
>>>
>>> /my/path/boost_1_40_0/include/
>>>
>>> since boost header files are included as follows
>>>
>>> #include <boost/regex.hpp>
>>>
>>> As for the compilation and installation of boost you can still refer
>>> to that blog post since those flags are for bootstrap and bjam anyway.
>>>
>> I understand the path-thing. In my case the file regex.hpp is in
>> H:\matthias\Documents\Dev\CPP\SVN\library\source\boost_1_40_0\boost
>>
>> which is why have set up
>> INCLUDEPATH +=
>> H:/matthias/Documents/Dev/CPP/SVN/library/source/boost_1_40_0/
>>
>> but that does not work. The error in qtcreator is:
>>
>> H:/matthias/Documents/Dev/CPP/SVN/library/source/source-highlight-3.1.2/lib/srchilite/substfun.h:13:
>> boost/regex.hpp: No such file or directory
>>
>>
>> The compilation output however does not include this path, which I do
>> not understand:
>> g++ -c -g -frtti -fexceptions -mthreads -Wall
>> -DABSOLUTEDATADIR=\"/usr/local/share/source-highlight/\"
>> -DVERSION=\"3.1.2\" -DLIBRARY_VERSION=\"3.0.0\"
>> -DPACKAGE=\"source-highlight\"
>> -DRELATIVEDATADIR=\"../share/source-highlight\" -DQT_DLL -DQT_GUI_LIB
>> -DQT_CORE_LIB -DQT_THREAD_SUPPORT
>> -I'c:/Programme/Qt/SDK/2009.04/qt/include/QtCore'
>> -I'c:/Programme/Qt/SDK/2009.04/qt/include/QtGui'
>> -I'c:/Programme/Qt/SDK/2009.04/qt/include'
>> -I'c:/Programme/Qt/SDK/2009.04/qt/include/ActiveQt' -I'debug'
>> -I'c:/Programme/Qt/SDK/2009.04/qt/mkspecs/win32-g++' -o
>> debug/substfun.o substfun.cpp
>
and sorry if I insist on this, but you should try with the simple
example of regexp
#include <boost/regex.hpp>
#include <iostream>
#include <string>
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}
in a single file (mytest.cpp) and compile it manually with the -I and -L
g++ -IH:/matthias/Documents/Dev/CPP/SVN/library/source/boost_1_40_0/
mytest.cpp -o mytest
-LH:/matthias/Documents/Dev/CPP/SVN/library/source/boost_1_40_0/lib
-lboost_regex
otherwise you might not understand what is going wrong... :)
cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net