G ++ communication problems: undefined function reference

I used CMake and Visual C ++ to create the Hyde library. Then, back in VC ++, I was able to successfully create the code and create an executable file that references HyDE.lib files and Hyde header files.

Then I discovered that in order to work with others in my company, it would be preferable to develop in Eclipse CDT. Knowing very little about the Eclipse CDT, I created the default hello world project, deleted the code, and then dumped all of my code into the src folder. Then I tried to change the include and lib and libs paths to reflect what worked in VC ++. At the moment, everything seems to be compiling, but I get an error:

/cygdrive/c/EclipseWorkspace/425HyDE/Debug/../src/FS5HyDE.cpp: 16: undefined link to `HyDEAPI :: HyDE :: HyDE (HyDESystemModel :: SystemModel *, bool) '

(There are many such errors, all refer to Hyde methods). Here's what is done on the command line:

g ++ -L "C: \ Progra ~ 1 \ boost \ boost_1_42 \ lib" -L "C: \ EclipseWorkspace \ HyDE" -o "425HyDE.exe". / src / Adapter _FS5HyDE.o./src/EPSCommands. o./src/EPSCurrentSensor.o./src/EPSFault.o./src/FS5HyDE.o./src/HyDEObservation.o./src/MCDH.o./src/MCDH_Module.o./src/PDBComponent.o ./src/PowerSystem.o./src/Program.o./src/SSPCComponent.o./src/Telemetry.o./src/TelemetryReport.o -l: libboost_thread-vc90-mt-gd-1_42.lib - lHyDE

This is definitely not a problem of streamlining the library, because I have another order (there are only two of them). Is it possible to have a problem with compiling HyDE.lib in VC ++ (which uses the Windows compiler) and compiling my program with g ++? Could there be a problem in how Eclipse CDT automatically runs make files? Any other ideas?

(Note: there seem to be many other questions on SO with similar issues, but after reading them, I haven't found the one that concerns my issue.)

+2
source share
3 answers

Decision. Since the HyDE library was compiled using the Visual Studios compiler, and I'm trying to create code that references it using the Cygwin tool binding, the two compilers use different name resolution schemes, so the last linker cannot find the expected characters in the Hyde library. The only solution I found was to recompile the Hyde library using the Cygwin toolkit or to compile the new code using any Visual Studios compiler used. (grunt grumble)

+1
source

Classic symbol error. Which source file defines:

HyDEAPI::HyDE::HyDE(HyDESystemModel::SystemModel*, bool)' ?

Was this file added to the compilation? Can you define it on a nested command line?

If this symbol belongs to an external library, after adding the directory path using -L you can add the name of the specific library that you want to link to your program using -L .

I am going to suggest that you add the directory path to HyDE.lib to the compilation command, and then the library name immediately, for example:

  -L"C:\path_to_hyde_library" -l:HyDE.lib 

and then let us know what happened.

+1
source

./src/FS5HyDE.o and ./src/HyDEObservation.o should be the last parameter, if required for other object files (* .o files), this means that the most necessary object files should appear last, as possible in the parameter list .

0
source

All Articles