JamesBremner / so76213744

Code for https://stackoverflow.com/q/76213744/16582
0 stars 0 forks source link

Use of undeclared identifier 'readfile' #1

Open kyssadin opened 1 year ago

kyssadin commented 1 year ago

As I understood, I was supposed to use the function from the provided 'GraphTheory.h' but it still does not work. The link provided in the code: https://github.com/JamesBremner/PathFinder The only readfile function from the provided repository only has 1 argument, but the one in code has 2 (a graph and a file)

JamesBremner commented 1 year ago

Sorry about that. The free function version of readfile is not fully tested so I have not yet committed to the main branch. ( The function should work used in this application ( I have been using it all day ) but I need to test that it hasn't broken anything in PathFinder )

For your convenience, I have committed it to a new branch readfile-free-function.

kyssadin commented 1 year ago

Can you clarify please, how do exactly should I use the new free function? Should I simply add the new code to the other project or I need to compile it in a new project? I'm a C++ Newbie, so I need to clarify these things, maybe there're some things I don't completely understand The error I'm getting:

cmd.exe /C "cd . && "D:\CLion 2023.1.2\bin\mingw\bin\g++.exe" -g  CMakeFiles/so76213744.dir/src/main.cpp.obj CMakeFiles/so76213744.dir/src/GraphTheory.cpp.obj CMakeFiles/so76213744.dir/src/cGraph.cpp.obj -o so76213744.exe -Wl,--out-implib,libso76213744.dll.a -Wl,--major-image-version,0,--minor-image-version,0  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
D:\CLion 2023.1.2\bin\mingw\bin/ld.exe: CMakeFiles/so76213744.dir/src/main.cpp.obj:C:/Users/1/source/repos/so76213744/src/main.cpp:200: undefined reference to `raven::graph::readfile(raven::graph::cGraph&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
JamesBremner commented 1 year ago

Looks like you are not using the makefile I provided.

JamesBremner commented 1 year ago

add the new code to the other project

No. Simply clone the pathfinder repo alongside the so762... repo

Like this:

image

JamesBremner commented 1 year ago

need to compile it in a new project

No. You do not need to build the PathFinder project. The so762... build will grab the code it needs from the Pathfinder clone.

JamesBremner commented 1 year ago

I can't assign you

Strange. Do you know why? Is there an error message?

JamesBremner commented 1 year ago

Are you now able to build the application?

JamesBremner commented 1 year ago

No answer :-(

I have added budget and interest levels to the input file. This meant that I needed a new readfile specifically for this application, so I made it a method of the cTourist class.

You still need the graph theory engine code from PathFinder.

And I still would like to know if you have been successful in building the latest version of the application which implements a complete answer to you stackoverflow question.

JamesBremner commented 1 year ago

I have merged the new code into PathFinder main branch. You should now build this application with PathFinder main branch checked out.