scpeters-test / sdformat

Simulation Description Format (SDF) parser and description files.
http://sdformat.org
Other
1 stars 0 forks source link

unresolved symbols when compiling with Qt's qmake #126

Open scpeters-test opened 8 years ago

scpeters-test commented 8 years ago

Original report (archived issue) by Federico Ferri (Bitbucket: f_ferri).


I get undefined symbols:

with this minimal testcase:

#include <sdf/sdf.hh>
int main(int argc, char **argv)
{
    sdf::SDFPtr sdfParsed(new sdf::SDF);
    sdf::init(sdfParsed);
    if(sdf::readFile(argv[1], sdfParsed))
    {
        sdf::ElementPtr e = sdfParsed->root;
        if(e->HasElement("model"))
        {
            std::cout << "the SDF contains a <model> element" << std::endl;
        }
    }
}

Note: platform is OSX, sdformat (2.3.2) is installed via homebrew.

When compiling with plain make, no undefined symbols.

qmakefile.pro:

QT += core
TARGET = sdftest
INCLUDEPATH += "/usr/local/Cellar/boost/1.60.0_1/include"
INCLUDEPATH += "/usr/local/Cellar/sdformat/2.3.2/include/sdformat-2.3"
INCLUDEPATH += "/usr/local/Cellar/tinyxml/2.6.2/include"
QMAKE_LIBDIR += "/usr/local/Cellar/sdformat/2.3.2/lib"
LIBS += "-lsdformat"
SOURCES += sdftest.cpp

Makefile

CXXFLAGS=-I/usr/local/Cellar/sdformat/2.3.2/include/sdformat-2.3
sdftest: sdftest.o
    $(CXX) -L/usr/local/Cellar/sdformat/2.3.2/lib -lsdformat $^ -o $@
scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters).


Are you using cmake? Is it possible to see the cmake code?

scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


I use qmake

scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


updated original issue description, with minimal testcase, qmakefile and classic makefile

scpeters-test commented 8 years ago

Original comment by Federico Ferri (Bitbucket: f_ferri).


scpeters-test commented 8 years ago

Original comment by Steve Peters (Bitbucket: Steven Peters).


Thanks for clarifying the issue. I don't often use qmake, so I'm not sure I can help at the moment. Perhaps someone with more experience with qmake can chime in.