Unresolved external symbols when using ORTools with VS19

331 views
Skip to first unread message

Diego Martino

unread,
Mar 30, 2021, 3:03:24 PM3/30/21
to or-tools-discuss
Hi

I'm trying to use ORTools within Visual Studio 2019 but I've been struggling many problems due to unresolved external symbols. I have already checked other issues and questions here in the group but I couldn't find how to fix it.

I've already tried two things:
- getting the code directly from GitHub and build using tools\make third_party and
- getting the compiled file available for VS19

But in both I have the same problem.

Some of the problems:
- LNK2001
- LNK2019
- LNK4049

Can anybody help me? Thanks

Mizux Seiha

unread,
Mar 31, 2021, 2:52:01 AM3/31/21
to or-tools-discuss
Don't get it...
1) Did you manage to run tests ?
```
make third_party
make cc
make test_cc
```

2) Which language are you using ? C++ ?

3) Did you try to integrate the OR-Tools C++ library in your project ?

4) If yes, how did you do that ? can we have a trace (detailed log) of the error ?

Diego Martino

unread,
Mar 31, 2021, 4:18:13 AM3/31/21
to or-tools-discuss
Hi
Sorry for not providing enough details

1) When I run make third_party directly from the source code, I got the following error:
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:44 (project):
  The CMAKE_CXX_COMPILER:
    C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
  is not a full path to an existing compiler tool.

2) Yes, C++ within VS2019

3, 4) Yes. 
In C++ > General >Additional include directories: path to include
In Linker > General > Additional library directoires: path to lib
In Linker > General > Additional dependencies: ortools.lib

5) These flags are already in the Makefile for the binary version

The log file is attached to the discussion (sorry but my VS19 is in french)

Thanks
detailed_log.txt

Laurent Perron

unread,
Mar 31, 2021, 4:29:01 AM3/31/21
to or-tools-discuss
You should build in release mode in /MD
Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00



--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/2eacec6c-ddf1-443f-b97a-81a1cc79aef5n%40googlegroups.com.

Diego Martino

unread,
Mar 31, 2021, 4:33:41 AM3/31/21
to or-tools-discuss
Building in release mode in \MD also gives me these problems (see attached log file)
detailed_log_MD_release.txt

Laurent Perron

unread,
Mar 31, 2021, 4:42:51 AM3/31/21
to or-tools-discuss
No, you are still compiling in /MT

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Diego Martino

unread,
Mar 31, 2021, 4:49:58 AM3/31/21
to or-tools-discuss
Now I think I changed that
detailed_log_MD_release.txt

Laurent Perron

unread,
Mar 31, 2021, 4:59:48 AM3/31/21
to or-tools-discuss
are you compiling in c++17 ?

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Diego Martino

unread,
Mar 31, 2021, 5:18:04 AM3/31/21
to or-tools-discuss
Yes
I changed it to 19 and it apparently worked for some example cpp files
However for the jobshop example (https://github.com/google/or-tools/blob/fa84bc05e72641dddfbb98164d81b8bc9bef6ea5/examples/cpp/jobshop_sat.cc#L34) I get some problems with the ABSL_FLAGS (log file attached). This problem is most related to C++ rather than ORTools?
absl_flags_problem.txt

Laurent Perron

unread,
Mar 31, 2021, 5:40:24 AM3/31/21
to or-tools-discuss
c++19 does not exist

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Diego Martino

unread,
Mar 31, 2021, 5:45:06 AM3/31/21
to or-tools-discuss
I thought you were talking about VS17 v141 and VS19 v142
I'm using C++14 in default mode. Should I use C++17 ?

Laurent Perron

unread,
Mar 31, 2021, 5:51:17 AM3/31/21
to or-tools-discuss
yes

Laurent Perron | Operations Research | lpe...@google.com | (33) 1 42 68 53 00


Diego Martino

unread,
Mar 31, 2021, 6:14:42 AM3/31/21
to or-tools-discuss
now it works correctly 
Thank you!

Reply all
Reply to author
Forward
0 new messages