Skip to content

Compilation Error and Warnings in Project #3

@coolbangstone0114

Description

@coolbangstone0114

Compilation Error and Warnings in Project

Description:

When attempting to compile the project using qmake and make, several warnings are encountered, and the build process fails with an error. Specifically, the error is related to a missing member in a struct (ResultPathInfo).

Environment:

  • OS: ubuntu 20.04
  • Compiler: g++ 9.4.0
  • QMake version: 3.1
    Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu

Steps to Reproduce:

  1. Clone the repository: git clone [repository URL]
  2. Navigate to the project directory: cd [repository directory]
  3. Run qmake to generate the Makefile.
  4. Run make to build the project.

Observed Output:

g++ -c -pipe -std=c++0x -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o main.o main.cpp
In file included from map.h:12,
                 from mission.h:4,
                 from main.cpp:1:
lineofsight.h: In member function ‘std::vector<std::pair<int, int> > LineOfSight::getCells(int, int)’:
lineofsight.h:292:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  292 |         for(int k=0; k<this->cells.size(); k++)
      |                      ~^~~~~~~~~~~~~~~~~~~
In file included from constraints_o.h:11,
                 from aa_sipp_optimal.h:3,
                 from mission.h:9,
                 from main.cpp:1:
StatesContainer.h: In constructor ‘StatesContainer::updateExpand::updateExpand(double, bool)’:
StatesContainer.h:68:16: warning: ‘StatesContainer::updateExpand::best_g’ will be initialized after [-Wreorder]
   68 |         double best_g;
      |                ^~~~~~
StatesContainer.h:67:14: warning:   ‘bool StatesContainer::updateExpand::expanded’ [-Wreorder]
   67 |         bool expanded;
      |              ^~~~~~~~
StatesContainer.h:55:9: warning:   when initialized here [-Wreorder]
   55 |         updateExpand(double best_g, bool expanded):best_g(best_g),expanded(expanded){}
      |         ^~~~~~~~~~~~
In file included from mission.h:9,
                 from main.cpp:1:
aa_sipp_optimal.h: In member function ‘void AA_SIPP_optimal::findSuccessors(Node, const Map&, std::__cxx11::list<Node>&, int)’:
aa_sipp_optimal.h:30:36: warning: unused parameter ‘curNode’ [-Wunused-parameter]
   30 |     void findSuccessors(const Node curNode, const Map &Map, std::list<Node> &succs, int numOfCurAgent){}
      |                         ~~~~~~~~~~~^~~~~~~
aa_sipp_optimal.h:30:56: warning: unused parameter ‘Map’ [-Wunused-parameter]
   30 |     void findSuccessors(const Node curNode, const Map &Map, std::list<Node> &succs, int numOfCurAgent){}
      |                                             ~~~~~~~~~~~^~~
aa_sipp_optimal.h:30:78: warning: unused parameter ‘succs’ [-Wunused-parameter]
   30 |     void findSuccessors(const Node curNode, const Map &Map, std::list<Node> &succs, int numOfCurAgent){}
      |                                                             ~~~~~~~~~~~~~~~~~^~~~~
aa_sipp_optimal.h:30:89: warning: unused parameter ‘numOfCurAgent’ [-Wunused-parameter]
   30 |     void findSuccessors(const Node curNode, const Map &Map, std::list<Node> &succs, int numOfCurAgent){}
      |                                                                                     ~~~~^~~~~~~~~~~~~
aa_sipp_optimal.cpp: In member function ‘void AA_SIPP_optimal::initStates(Agent, const Map&)’:
aa_sipp_optimal.cpp:113:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const unsigned int’ [-Wsign-compare]
  113 |     for(int i = 0; i < Map.height; i++)
      |                    ~~^~~~~~~~~~~~
aa_sipp_optimal.cpp:114:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const unsigned int’ [-Wsign-compare]
  114 |         for(int j = 0; j < Map.width; j++)
      |                        ~~^~~~~~~~~~~
aa_sipp_optimal.cpp:125:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<double, double> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  125 |             for(int k = 0; k < begins.size(); k++)
      |                            ~~^~~~~~~~~~~~~~~
In file included from constraints_o.h:8,
                 from aa_sipp_optimal.h:3,
                 from aa_sipp_optimal.cpp:1:
structs.h: In member function ‘Node& Node::operator=(const Node&)’:
structs.h:62:8: warning: implicitly-declared ‘SafeInterval& SafeInterval::operator=(const SafeInterval&)’ is deprecated [-Wdeprecated-copy]
   62 | struct Node
      |        ^~~~
structs.h:59:5: note: because ‘SafeInterval’ has user-provided ‘SafeInterval::SafeInterval(const SafeInterval&)’
   59 |     SafeInterval(const SafeInterval &other) { begin = other.begin; end = other.end; id = other.id;}
      |     ^~~~~~~~~~~~
aa_sipp_optimal.cpp: In member function ‘ResultPathInfo AA_SIPP_optimal::findPath(const Map&, Agent, DynamicObstacles&, Heuristic&)’:
aa_sipp_optimal.cpp:178:19: note: synthesized method ‘Node& Node::operator=(const Node&)’ first required here
  178 |         newNode = curNode;
      |                   ^~~~~~~
aa_sipp_optimal.cpp:215:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<Node>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  215 |         for(int i = 1; i < hppath.size(); i++)
      |                        ~~^~~~~~~~~~~~~~~
aa_sipp_optimal.cpp:225:20: error: ‘struct ResultPathInfo’ has no member named ‘time’; did you mean ‘runtime’?
  225 |         resultPath.time = (end.tv_sec - begin.tv_sec) + static_cast<double>(end.tv_usec - begin.tv_usec) / 1000000;
      |                    ^~~~
      |                    runtime
make: *** [Makefile:486: aa_sipp_optimal.o] Error 1

Errors and Warnings:

  1. Comparison of Integer Expressions of Different Signedness: Several warnings related to comparisons between signed and unsigned integers.
  2. Unused Parameters: Multiple warnings about unused parameters in functions.
  3. Reordering of Initialization List: Warning about the order of initialization in the constructor.
  4. Deprecated Copy Assignment: Warning related to deprecated copy assignment operator.
  5. Missing Struct Member: Error stating that ResultPathInfo does not have a member named time.

Additional Information:

If you need further assistance or clarification, please let me know. I can provide additional details or help with specific parts of the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions