vcpkg manifest mode libraries not found in main.cpp #73
Replies: 3 comments 6 replies
-
find_package(fmt REQUIRED)
^ fmt is imported here on line 31
target_link_libraries(proj_lib PRIVATE fmt::fmt)
^ ^
| linked as a build requirement
your library target |
Beta Was this translation helpful? Give feedback.
-
to give more background #include <iostream>
#include <string>
#include "lib.hpp"
#include <fmt/core.h> // added to trigger the error
auto main() -> int
{
auto const lib = library {};
auto const message = "Hello from " + lib.name + "!";
std::cout << message << '\n';
return 0;
} results in this compiling error
checking the generated vcproj files: in the generated *_lib.vcproj, it's like this <ClCompile>
<AdditionalIncludeDirectories>F:\testme\source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>%(AdditionalOptions) /external:I "F:/testme/build/dev-win64/vcpkg_installed/x64-windows-static-md/include" /utf-8 /volatile:iso /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew</AdditionalOptions> in the generated *_exe.vcproj, it's like this <ClCompile>
<AdditionalIncludeDirectories>F:\testme\source;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>%(AdditionalOptions) /utf-8 /volatile:iso /Zc:__cplusplus /Zc:externConstexpr /Zc:throwingNew</AdditionalOptions> There's Anybody know where this setting is controlled? |
Beta Was this translation helpful? Give feedback.
-
THIS did it. However I find it counter-intuitive. with Probably I read it too literally and have always got the semantics wrong. Thanks for the help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that in the generated code, there are 2 projects, one for library(lib.h/.cpp) and the other for executable(main.cpp).
when I try to include vcpkg installed library in the main.cpp, it cannot find it. moving the #include <fmt/core.h> from lib.cpp over to main.cpp yieds the same error , while it's perfect fine in the lob.cpp file.
by checking the Cmakelist.txt file, I Couldn't find which line causes this difference.
my questions:
Beta Was this translation helpful? Give feedback.
All reactions