#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main()
{
FI_Window window(200, 200, "Window title"); // error: FI
FL_Box box(0, 0, 200, 200, "Hey, I mean, Hello, World! ");
window.show();
return Fl::run();
}
I build the above code in VS 2019 and and get an error code LNK1104 | Can not open file "fltkd.lib". I have all the linker settings/values checked as suggested in the book Programming Principles and Practices using C++ by Bjarne Stroustrup and other online sources but still I am getting the error. Is there some different settings with VS 2019 or am I putting the libs file in the wrong directries.
Directory where I put the libs files:-
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\lib
LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
If you compiled one file to use one kind of run-time library and another file to use another kind (for example, debug versus retail) and tried to link them, you will get this warning. You should compile all source files to use the same run-time library.
Project -> Properties -> C/C++ -> Code Generation -> Runtime Library
There are 4 versions of the CRT link libraries present in vc\lib:
libcmt.lib: static CRT link library for a release build (/MT)
libcmtd.lib: static CRT link library for a debug build (/MTd)
msvcrt.lib: import library for the release DLL version of the CRT (/MD)
msvcrtd.lib: import library for the debug DLL version of the CRT (/MDd)
According to the Doc:Linker Tools Warning LNK4098
when your executable uses the multi-threaded, non-debug run-time libraries, the list reported should include LIBCMT.lib, and not LIBCMTD.lib, MSVCRT.lib, or MSVCRTD.lib. You can tell the linker to ignore the incorrect run-time libraries by using /NODEFAULTLIB for each library you want to ignore.
Related
I am trying to use Open Cv on Visual studio to write c++ code. I tried a lot of ways to reach this goal for 3 days. here is what I did in these days:
**1.download and extract open cv 4.1.1 (C:\opencv).
2.download and install Visual Microsoft Studio 2019.
3.copy the bin directory of open cv to the system variable path.
(in my case:"C:\opencv\build\x64\vc15\bin;C:\opencv\build" )
4.add include folder to the project's properties(my project name is opencv):
(properties->configuration properties ->edite include directories value to : (C:\opencv\build\include )
5.edite library directory to ( C:\opencv\build\x64\vc15\lib)
6.then in linker menu->inpute->adittional dependancies -> edit its value to "opencv_world411d.lib" .**
now I write a simple code to test open cv:
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
int main() {
Mat im = imread("cameraman.tiff", 0);
}
this code built correctly but when I run it It doesn't work with error :
Unhandled exception at 0x000007FEBA8D3AE2 (opencv_world411d.dll) in opencv.exe: 0xC000001D: Illegal Instruction.
gfluidimgproc_func.simd.hpp not found
You need to find gfluidimgproc_func.simd.hpp to view the source for the current call stack frame
"I added screenshot"
error report
also, I tried Cmake too.
first, configure and generate OpenCV's source file.
second, open the project in Microsoft visual studio and build all
then I build the install folder.all has been done successfully.
questions:
1.how can I fix this error to run OpenCV on Microsoft visual studio 2019 ?
does Microsoft visual studio 2019 support open cv 4.1.1? have you tried it?
tanks for your attention.
my operation system is: windows 7
intel core i5
>>4.add include folder to the project's properties(my project name is opencv): (properties->configuration properties ->edite include directories value to : (C:\opencv\build\x64 )
This is wrong, you should add C:\opencv\build\include and C:\opencv\build\include\opencv2 to the include directories in your case.
I test your case on My PC, I use VS2019 and OpenCV4.1.1 to make a test. Your other steps are correct. This step will cause the header file not to be found, so the corresponding function can not be identified and will be displayed as illegal instructions.
I have the same problem and from what I understand it is because we compile in x64 bit and execute it on an old CPU which doesn't support sse3 instructions (in my case an old i5 750). I believe your only solution is to recompile OpenCV either in 32bit or in 64bit with sse3 disabled.
I'm rather new to C++. I'm trying to use VS2015 and the lp_solve library(https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.5/) to solve my linear eq problem(for exact Gromov-Hausdorrf Distance, see https://mediatum.ub.tum.de/doc/1231885/1231885.pdf section 3.1 and 3.3). My machine is x64 system. Here is what I've done:
donwload the lp_solve_5.5.2.5_dev_win64.zip package and decompress it.
specific the library directoy(through project -> properties -> linker)
specific lib I used (liblpsolve55.lib and liblpsolve55d.lib for statically linking) through project->properties->linker->input->additional dependency.
declare the .h file directory(through project->properties->C/C++).
Here is what I declare in my code:
#include "lp_lib.h"
#pragma comment(lib, "liblpsolve55.lib") // static
#pragma comment(lib, "liblpsolve55d.lib") // static for debug
While when I run the code with x86, it will show the following problems:
error LNK2019: unresolved external symbol _make_lp#8 referenced in function "void __cdecl my_solve [totally 13 errors like this]
warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64' [totally 2 warnings like this]
While when I switch the runner with x64:
I got 550 errors, mainly due to the “dlfcn.h”: No such file or directory
in the lp_lib.h file, it has lines:
#if (LoadInverseLib == TRUE) || (LoadLanguageLib == TRUE)
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
#endif
which means it has treat me as a linux machine since dlfcn.h is for unix/linux
I've also try to use the 32bit version package(lp_solve_5.5.2.5_dev_win32.zip), but it do not work either.
with x86 runner:__iob, _printf issues.
with x64 runner:“dlfcn.h”: No such file or directory
I've successively build and run the demo in my mac with the corresponding package(lp_solve_5.5.2.5_dev_osx32.tar.gz). But I still want to know how to build and run it in VS2015.
Here I'll state what I do in mac if anyone need it(using Xcode).
download the lp_solve_5.5.2.5_dev_osx32.tar.gz package
add all the .h file in build phase -> headers
add the liblpsolve55.a file in build phase -> link binary with libraries
(if you want to use .dylib as dynamic linking, add it to the build phase -> copy file, but it do not work for me)
in build setting, set the Architectures to 32-bit intel
in build setting, set the Build Active Architecture Only to No
Thank you very much, actually nobody answer this question :) But I've solve the problem myself. Here is what I do for VS2015:
use package lp_solve_5.5.2.5_dev_win32.zip
add the .h file and .lib as above
change the run library, through properties -> C/C++ -> code generation -> run library -> change the DLL(/MDd) to (/MTd)
if you still got some fprintf issues, go to properties -> linker -> input -> additional dependency, and add : legacy_stdio_definitions.lib
That will be OK. That my be some translation issue, yes I use the chinese-version VS...
So my goal is to build a native WebRTC application using the WebRTC C++ api.
I compiled webrtc for use with Visual Studio (2015) using the following guide:
https://github.com/ipop-project/ipop-project.github.io/wiki/Building-the-WebRTC-lib-for-Windows
After the build completed I tried creating a new Visual Studio console project and added the following code:
#include <iostream>
#define WEBRTC_WIN
#include <webrtc/api/peerconnection.h>
#include <webrtc/api/peerconnectionfactory.h>
#include <webrtc/api/peerconnectioninterface.h>
int main()
{
auto pcf = webrtc::CreatePeerConnectionFactory();
std::cout << "Hallo!" << std::endl;
}
Adding the build directory to the include search path works fine, however I'm unable to link the application, searching the build directories for lib-files and adding them to the linker only adds more link error as there is a whole bunch and I suspect some of them should not be linked to my application.
What is the correct way to link the application, and how do I know what .lib-files the functionality I use resides in?
I solved it!
After digging around in the build files for the examples in WebRTC I found that the following libraries should be linked:
obj\webrtc\api\libjingle_peerconnection.lib
obj\webrtc\system_wrappers\field_trial_default.lib
obj\webrtc\system_wrappers\metrics_default.lib
obj\third_party\jsoncpp\jsoncpp.lib
obj\webrtc\media\rtc_media.lib
obj\webrtc\base\rtc_base_approved.lib
obj\webrtc\webrtc_common.lib
obj\webrtc\webrtc.lib
obj\webrtc\system_wrappers\system_wrappers.lib
obj\webrtc\voice_engine\voice_engine.lib
obj\webrtc\common_audio\common_audio.lib
obj\third_party\openmax_dl\dl\openmax_dl.lib
obj\webrtc\common_audio\common_audio_sse2.lib
obj\webrtc\modules\audio_coding_module.lib
obj\webrtc\modules\cng.lib
obj\webrtc\modules\audio_encoder_interface.lib
obj\webrtc\modules\g711.lib
obj\webrtc\modules\pcm16b.lib
obj\webrtc\modules\ilbc.lib
obj\webrtc\modules\webrtc_opus.lib
obj\third_party\opus\opus.lib
obj\webrtc\modules\g722.lib
obj\webrtc\modules\isac.lib
obj\webrtc\modules\audio_decoder_interface.lib
obj\webrtc\modules\isac_common.lib
obj\webrtc\modules\red.lib
obj\webrtc\rtc_event_log.lib
obj\webrtc\rtc_event_log_proto.lib
protobuf_lite.dll.lib
obj\webrtc\modules\neteq.lib
obj\webrtc\modules\builtin_audio_decoder_factory.lib
obj\webrtc\modules\audio_decoder_factory_interface.lib
obj\webrtc\modules\rent_a_codec.lib
obj\webrtc\modules\audio_conference_mixer.lib
obj\webrtc\modules\audio_processing.lib
obj\webrtc\modules\audioproc_debug_proto.lib
obj\webrtc\modules\audio_processing_sse2.lib
obj\webrtc\modules\webrtc_utility.lib
obj\webrtc\modules\media_file.lib
obj\webrtc\base\rtc_task_queue.lib
obj\webrtc\modules\audio_device.lib
obj\webrtc\modules\bitrate_controller.lib
obj\webrtc\modules\paced_sender.lib
obj\webrtc\modules\rtp_rtcp.lib
obj\webrtc\common_video\common_video.lib
libyuv.lib
obj\third_party\libjpeg_turbo\libjpeg.lib
obj\webrtc\modules\remote_bitrate_estimator.lib
obj\webrtc\voice_engine\level_indicator.lib
obj\webrtc\modules\congestion_controller.lib
obj\webrtc\modules\video_capture_module.lib
obj\webrtc\modules\video_processing.lib
obj\webrtc\modules\video_processing_sse2.lib
obj\webrtc\modules\webrtc_video_coding.lib
obj\webrtc\modules\webrtc_h264.lib
obj\webrtc\modules\webrtc_i420.lib
obj\webrtc\modules\video_coding\utility\video_coding_utility.lib
obj\webrtc\modules\video_coding\codecs\vp8\webrtc_vp8.lib
obj\third_party\libvpx\libvpx.lib
obj\third_party\libvpx\libvpx_intrinsics_mmx.lib
obj\third_party\libvpx\libvpx_intrinsics_sse2.lib
obj\third_party\libvpx\libvpx_intrinsics_ssse3.lib
obj\third_party\libvpx\libvpx_intrinsics_sse4_1.lib
obj\third_party\libvpx\libvpx_intrinsics_avx.lib
obj\third_party\libvpx\libvpx_intrinsics_avx2.lib
obj\webrtc\modules\video_coding\codecs\vp9\webrtc_vp9.lib
obj\webrtc\p2p\rtc_p2p.lib
obj\webrtc\base\rtc_base.lib
boringssl.dll.lib
obj\third_party\usrsctp\usrsctplib.lib
obj\webrtc\modules\video_capture_module_internal_impl.lib
obj\third_party\winsdk_samples\directshow_baseclasses.lib
obj\webrtc\pc\rtc_pc.lib
obj\third_party\libsrtp\libsrtp.lib
winmm.lib
dmoguids.lib
wmcodecdspuuid.lib
amstrmid.lib
msdmo.lib
crypt32.lib
iphlpapi.lib
secur32.lib
Strmiids.lib
The document you linked to, says you need the following libraries:
boringssl.dll.lib
boringssl_asm.lib
field_trial_default.lib
jsoncpp.lib
rtc_base.lib
rtc_base_approved.lib
rtc_p2p.lib
rtc_xmllite.lib
rtc_xmpp.lib
I would link against all of them. It's unlikely to hurt.
There is a precompiled (binary) package available for Windows: here.
It contains a single lib to link, libwebrtc_full.lib
I'm getting this linker error when I try to compile the hello world .cpp after installing the FLTK kit.If you notice the library names are from installation found in appendix D in the stroustrup book "programming principles and practice". The edition is 2012 but it seems that FLTK version is a bit different now, for instance the version the book recommends to down load is FLTK 1.1.(?), and 1.3.2 is the latest. I think the linker problem is inside my VC++ project under the project/properties/linker/input/additional dependencies tab I put (per appendix d)
fltk.lib
wsock32.lib
comctl32.lib
fltkjpegd.lib
fltkimagesd.lib
But the .lib files I copied from the fltk lib folder didn't have those names. They are named:
fltkzlibd
fltkpngd
fltkjpegd
fltkimagesd
fltkformsd
fltkgld
fltkd
Are these the .lib files to include in VC++ project under the project/properties/linker/input/additional dependencies tab ? If not, how else can I fix this mess?
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1> test.cpp
1>LINK : fatal error LNK1104: cannot open file 'fltk.lib wsock32.lib comctl32.lib fltkjpegd.lib fltkimagesd.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>
int main(int argc, char **argv)
{
Fl_Window *window = new Fl_Window(300,180);
Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
box->box(FL_UP_BOX);
box->labelsize(36);
box->labelfont(FL_BOLD+FL_ITALIC);
box->labeltype(FL_SHADOW_LABEL);
window->end();
window->show(argc, argv);
return Fl::run();
}
Include those lib files for the debug version. The release versions don't have the trailing d.
For the linking, use ws2_32.lib instead of wsock32.lib.
When adding your additional dependencies, did you click on the ellipsis and then in the dialog enter all the library names on one line? They need to be entered on separate lines.
I have written the following code
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <boost/system/windows_error.hpp>
using namespace boost::system;
int main(){
boost::asio::io_service io;
boost::asio::deadline_timer t(io,boost::posix_time::seconds(5));
t.wait();
std::cout<<"hello world";
return 0;
}
and I get the following error:
1>LINK : fatal error LNK1104: cannot open file 'libboost_system-vc100-mt-gd-1_44.lib'
I dont know how and what do, can you please explain what is happening and what steps I can take to fix it?
Ok, for MSVC++ 2010
Under Project Properties, goto
Configuration Properties -> Linker -> General -> Additional Library Directories and add there the path to the *.lib file (For example: C:\boost_1_41_0\stage\lib)
As far as I can tell from the error message it compiles but can't find the boost compiled libraries.
These you have to build yourselves unless you can find them prebuilt.
IIRC boost are built using a tool called bjam. I think this explains it rather throughly: http://www.highscore.de/cpp/boostbuild/index.html.
After it's built you have to instruct the compiler to link it using the project properties.
I suspect you haven't built the libraries. You can get the pre-built libraries from BoostPro or you can build them yourself following the instructions at http://www.boost.org/doc/libs/1_44_0/more/getting_started/windows.html
I was working in one instance of Visual Studio 2010. When I started up another, to scrawl out a bit of code, I was shocked to see the same error message. Reset includes and lib (Project->NameofProject Properties then select VC++ Directories) and toggled back and forth between debug and release, at first just once, then a few more times, as I grew increasingly alarmed at none of this working.
Even though the IDE didn't report any activity ('Build Failed,' was all it said in the place where it shows includes/libs being enumerated) after a few minutes (of furious web browsing) I came back to discover that it had silently self-fixed.