C++ Linker Issue

78 views
Skip to first unread message

Larry Rix

unread,
Sep 17, 2020, 10:05:01 AM9/17/20
to Eiffel Users
Good morning, All!

I have a new 3D printer. There is a source site for parts called McMaster-Carr, which carries all sorts of parts (www.mcmaster.com). For a lot of their parts, they have 3D CAD files in various forms. One of the formats is STEP files. The online 3D software I have been using is TinkerCAD (www.tinkercad.com). It can import various formats, but not anything on the McMaster-Carr list (e.g. STEP). So, to this end, I thought it would be fun to find a C/C++ library capable of the needed conversation (STEP to STL).

I found an open-source library called Open Cascade, which is a rich source of C++ code for working with 3D drawings. It has an equally rich set of conversion features in code.

I downloaded their Windows installer, which put the entire Open Cascade source on to my local C drive. The path to the source is: C:\OpenCASCADE-7.4.0-vc14-64\opencascade-7.4.0

Once loaded, I created a new Eiffel project and set the following Advanced->Externals:

eiffel_open_cascade_externals.JPG

I end up with 3 linker issues, which I guess might stem from just one missing part.

When I ran into something like this before, I was able to get around it by using g++ -c -o to create an obj file from the C/C++ source and then tell Eiffel Studio externals about that so the compiler could be told about it by Eiffel at compile-time. This was successful on my Linux RaspberryPi, but the g++ in Windows using the VS2019 DOS Cross Tools Command Prompt (x86/x64) fails.

Therefore, I am a little stuck because of my own ignorance and lack of experience with compiling C/C++. I don't know if there is some way for me to set an Eiffel Studio setting that will tell it where the missing Linker-needed-files are located -OR- if I need to get a better handle on the g++ compiler creating an obj or lib file to point Eiffel Studio at -OR- if there is another route to getting this resolved.

The C++ compiler Linker issue is below. Also, there is my one external wrapped feature as an example, which is the Eiffel source.

eiffel_open_cascade_wrapped_external_call.JPG

Perhaps it would be helpful for you to know a little about file organization in Open Cascase as well:

eiffel_open_cascade_include_folder.JPG

This folder has more than just HXX files. It also has GXX and LXX files. A Google search for information on LXX comes up with the following:

eiffel_open_cascade_lxx_file.JPG

Therefore—the "inc" folder are the includes, whereas the "src" folder has any number of subfolders with both CXX and HXX code and header files. For example, the Linker errors mention Standard and Standard_OutOfMemory, which have files located in the standard folder.

eiffel_open_cascade_src_standard_inc.JPG

Finally—here is the Eiffel Studio Output tab compiler result text with the Linker issues towards the bottom (3 each).


Preparing C compilation using Microsoft Visual Studio 2019 VC++ (19.0)...
eoption.c
epattern.c
efrozen.c
ecall.c
eplug.c
eskelet.c
enames.c
evisib.c
ececil.c
einit.c
eparents.c
        1 file(s) copied.
'emain.obj' is up-to-date
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.25.28614.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-STACK:5000000 -NODEFAULTLIB:libc -STACK:5000000 -NODEFAULTLIB:libc -SUBSYSTEM:WINDOWS -OUT:estlconverter.exe 
e1\emain.obj 
"C:\Program Files\Eiffel Software\EiffelStudio 19.12 GPL\studio\spec\win64\lib\msc_vc140\mtwkbench.lib" "C:\Program Files\Eiffel Software\EiffelStudio 19.12 GPL\library\net\spec\msc_vc140\win64\lib\mtnet.lib" "C:\OpenCASCADE-7.4.0-vc14-64\opencascade-7.4.0\win64\vc14\lib\TKMesh.lib" Mswsock.lib 
USER32.lib WS2_32.lib ADVAPI32.lib GDI32.lib SHELL32.lib MSIMG32.lib COMDLG32.lib UUID.lib OLE32.lib OLEAUT32.lib COMCTL32.lib MPR.LIB SHLWAPI.LIB WINSPOOL.LIB 
estlconverter.res 
E1\eparents.obj E1\einit.obj E1\ececil.obj E1\evisib.obj E1\enames.obj 
E1\eskelet.obj E1\eplug.obj E1\ecall.obj E1\efrozen.obj E1\epattern.obj 
E1\eoption.obj C30\Cobj30.lib C29\Cobj29.lib C28\Cobj28.lib C27\Cobj27.lib 
C26\Cobj26.lib C25\Cobj25.lib C24\Cobj24.lib C23\Cobj23.lib C22\Cobj22.lib 
C21\Cobj21.lib C20\Cobj20.lib C19\Cobj19.lib C18\Cobj18.lib C17\Cobj17.lib 
C16\Cobj16.lib C15\Cobj15.lib C14\Cobj14.lib C13\Cobj13.lib C12\Cobj12.lib 
C11\Cobj11.lib C10\Cobj10.lib C9\Cobj9.lib C8\Cobj8.lib C7\Cobj7.lib 
C6\Cobj6.lib C5\Cobj5.lib C4\Cobj4.lib C3\Cobj3.lib C2\Cobj2.lib 
C1\Cobj1.lib 
   Creating library estlconverter.lib and object estlconverter.exp
Cobj2.lib(big_file_C2_cpp.obj) : error LNK2019: unresolved external symbol "public: static void * __cdecl Standard::Allocate(unsigned __int64)" (?Allocate@Standard@@SAPEAX_K@Z) referenced in function "public: static void * __cdecl STEPControl_Reader::operator new(unsigned __int64)" (??2STEPControl_Reader@@SAPEAX_K@Z)
Cobj2.lib(big_file_C2_cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl Standard_OutOfMemory::Standard_OutOfMemory(char const * const)" (??0Standard_OutOfMemory@@QEAA@QEBD@Z) referenced in function "public: void __cdecl Standard_OutOfMemory::`default constructor closure'(void)" (??_FStandard_OutOfMemory@@QEAAXXZ)
Cobj2.lib(big_file_C2_cpp.obj) : error LNK2019: unresolved external symbol "public: __cdecl STEPControl_Reader::STEPControl_Reader(void)" (??0STEPControl_Reader@@QEAA@XZ) referenced in function inline_F44_6611
estlconverter.exe : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX64\x64\link.EXE"' : return code '0x460'
Stop.



Larry Rix

unread,
Sep 17, 2020, 10:07:38 AM9/17/20
to Eiffel Users
BTW—I added an Advanced->Externals->Include for the "src/standard" folder just in case that would resolve the compiler's issue and the Linker errors downstream of it. It did not work.

Larry Rix

unread,
Sep 17, 2020, 10:35:00 AM9/17/20
to Eiffel Users
I am now wondering if I truly need to bite-the-bullet of C/C++ and something like CMake so that I can quit using you all as my crutch, eh? :-)

Alexander Kogtenkov

unread,
Sep 17, 2020, 10:44:51 AM9/17/20
to eiffel...@googlegroups.com
It looks like C++ header files were correctly included, but some library is missing. I do not know whether the framework comes with a complete ready-to-use set of libraries or you need to build some of them yourself (an option mentioned somewhere on their site with an explanation that there are different C++ compilers). You can check if there are some other libraries in addition to TKMesh.lib. If not, probably, you need to follow their guides to build the required library yourself.
 
Alexander Kogtenkov
 
 
Larry Rix <lar...@moonshotsoftware.com>:
 
--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/f9ce6fb9-cf39-403c-9827-90f00ecf6a9an%40googlegroups.com.
 

Larry Rix

unread,
Sep 17, 2020, 8:22:54 PM9/17/20
to Eiffel Users
Thank you, Alex!

That's a great clue!
Reply all
Reply to author
Forward
0 new messages