Not able to configure wxwidgets in Visual Studio 2017.
Followed these steps.
From wxwidgets website, downloaded Source Code 'Windows 7Z' file, Version 3.1.3.
Run the wx_vc15.sln from build ->msw in Visual Studio 2017.
Build the Debub, DLL Debug, DLL Release, Relese successfully with Platform x86.
In Microsoft Visual Studio 17 V15.9.20, created an empty project. Added a simple wxWidgets program.
In project properties made the below changes
- In All Configurations with Platform Win32, Set the Configuration Properties -> Character Set to Use Unicode Character Set
C/C++ -> Additional Include Directories -> $(WXWIN)\include\msvc;$(WXWIN)\include;
C/C++ -> Preprocessor -> Preprocessor Defenitions -> __WXMSW__;WXUSINGDLL;_DEBUG
Linker -> Additional Library Directories -> $(WXWIN)\lib\vc_dll
Made these changes in Environment Variables
In User variables
Add a new variable WXWIN and set its value to C:\Users\varun\Desktop\workspace\wxWidgets-3.1.3.
Path -> C:\Users\varun\Desktop\workspace\wxWidgets-3.1.3\lib\vc_dll.
In project properties Release Configurations, made these changes
C/C++ -> Preprocessor -> Preprocessor Defenitions -> __WXMSW__;WXUSINGDLL;NDEBUG;
There is no code error but Linker Tools Error
Error (active) E1097 unknown attribute "no_init_all" WxWidgets_Application_5 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um\winnt.h
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ) WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\WxWidgets_Application_3\MSVCRTD.lib(exe_main.obj)
Error LNK1120 1 unresolved externals WxWidgets_Application_3 C:\Users\varun\Desktop\workspace\visual_studio_projects_2017\WxWidgets_Application_3\Debug\WxWidgets_Application_3.exe
What could have gone wrong?
The first error you show is not an error at all but just some IntelliSense noise, see this bug report. The real error is not being able to find _main which seems to indicate that you're building a console application (see Properties\Linker\System\SubSystem option), so it should be fixed by just making it a Windows application instead.
Also, while I don't see anything really wrong with your setup, I would still recommend using the official instructions instead. Notably in your case it should be as simple as:
If you use MSVS 2010 or later IDE for building your project, simply add wxwidgets.props property sheet to (all) your project(s) using wxWidgets. You don't need to do anything else.
Related
I am new to SCIP and I encounter this problem when I tried to build the branch-and-price framework I obtained from this link.
For your reference, I use MS Visual Studio 2019. I have downloaded and installed the precompiled packages. Then, I conducted the following steps in the property of the project I built in VS 2019.
C/C++ -> General -> Additional Include Directories -> C:\Program Files\SCIPOptSuite 8.0.1\include
Linker -> Input -> C:\Program Files\SCIPOptSuite 8.0.1\lib\libsoplex.lib
Then, I build the program, and many errors (LNK2001) appear, e.g. , unresolved external symbol _imp_SCIPaddCoefLinear, etc.
I have tried to put another library in the Linker, i.e.,
Linker -> Input -> C:\Program Files\SCIPOptSuite 8.0.1\lib\libscip.lib
But, the program raises another error saying the libscip.dll is not found and I am suggested to re-install the package to fix the problem.
I have also tried to reinstall the package, but I still do not have libscip.dll in the folder of SCIPOptSuite 8.0.1.
Do you have any suggestions for properly installing and using the SCIP framework in MS Visual Studio?
Thank you in advance.
Obtained from #Richard Critten:
"...error saying the libscip.dll is not found ..." the directory containing libscip.dll need to be on the PATH or libscip.dll needs to be in the same directory as the executable.
I cannot figure out how to get sqlite3.dll (or any dll for that matter) to work with my C++ project in Visual Studio.
The error message I get is LNK2001 unresolved external symbol sqlite3_open
Here's what I did so far:
I put the .dll in myProjectFoler/Resources/sqlite3.dll
I generated sqlite3.lib using Visual Studio Developer Command Prompt using a command lib /def:sqlite3.def
I referenced the directory with the lib in Project -> Preferences -> Linker -> General -> Additional Library directories, and then referenced the .lib in Project -> Preferences -> Linker -> Input-> Additional dependencies
I placed sqlite3.h in my project and #included it
(pretty much followed the instructions seen here)
Thank you for help
The issue is that by default the header file assumes that sqlite is linked statically, as opposed to dynamic linking to a dll.
This part of sqlite3.h is responsible for that:
#ifndef SQLITE_API
# define SQLITE_API
#endif
If you set a per-project define in project properties:
SQLITE_API=__declspec(dllimport)
this should resolve your link error.
Alternatively, you can put
#define SQLITE_API __declspec(dllimport)
right before where you #include sqlite3.h.
It's difficult to tell exactly why the problem occurred. There are lots of reasons which could cause LNK2001 error. MSDN contains good check list.
You could try to use /VERBOSE option to determine which files the linker references. Put this option in Project -> Preferences -> Linker -> Command Line -> Additional Options. Output should contains similar strings:
Searching e:\SQLite\sqlite-dll-win32-x86-3150100\sqlite3.lib:
Found _sqlite3_open
Referenced in ConsoleApplication2.obj
Loaded sqlite3.lib(sqlite3.dll)
Pay attention to the VS runtime libraries, there should be no mixup between Debug and Release libraries.
I am trying to extend my knowledge of constrain programming and I want to build a simple example using google's or-tools in VS2015.
However I am constantly nagged by those linker errors. LNK2019 and LNK2001. Why is linking in VS so darn hard.
Google's or-tools comes in a perfect folder, with an include subfolder and lib subfolder with one single .lib file.
I have added Additional Library Dependencies.
Configuration Properties -> Linker -> General Additional Library Dependencies : C:\PATH\or-tools.VisualStudio2013-64b\lib
Set the Input under the Linker properties section.
Configuration Properties -> Linker -> Input Additional Dependencies : ortools.lib
Infomed VC++ where the include directory is.
Configuration Properties -> VC++ Directories : C:\PATH\or-tools.VisualStudio2013-64b
However it is still throwing link errors when building the solution. What am I missing here.
Thanks in advance.
edit:
spelling
Since the VS2013 and VS2015 compiler versions are incompatible, you have to build the lib from source. Though beware that this might entail a bit more work when linking with VS2015. Specifically I've had to manually resolve the following issues:
Change protobuf-3.0.0-beta-1 to protobuf-3.0.0-beta-2(bonus. not really necessary)
gflags 2.1.2 failed to compile due to a conflict of names around snprintf. To resolve this download the latest gflags version from GitHub and overwrite the one in %OR_TOOLS%\dependencies
Look up all VS solution files (.sln) in dependencies\sources\cbc-2.9.7 and convert to VS2015 format by simply double clicking them and following the instructions.
Add the following code to makefiles\Makefile.port
ifeq ("$(VisualStudioVersion)", "14.0")
VISUAL_STUDIO=2015
VS_RELEASE=v140
VS_COMTOOLS=140
else
...
endif
Replace Visual Studio 12 2013 with Visual Studio 14 2015
Rerun make third_party after each step.
Or you can just download the end result, linked on Windows 10 x64 VS2015 update 1. I've included the whole folder after running make third_party && make cc.
I'm compiling a legacy Visual Studio 6.0 C++ application in Visual Studio 2015 and I've run into this error and searching the net hasn't yielded any useful information.
LNK2019 unresolved external symbol __except_handler4_common referenced in function __except_handler4 (MSVCRT.lib)
I understand that somewhere in the code is referencing a method no longer(?) present in current versions of MSVCRT. Is there a workaround / compiler flag for this?
The error message is actually saying the the function __except_handler4, defined in MSVCRT.LIB, references the undefined symbol __except_handler4_common. So it's not your code that's making the this reference, it's Visual Studio 2015's code.
The symbol __except_handler4_common is defined in vcruntime.lib. This file should be automatically be linked in. I'm not sure why it wasn't. Did you select the static runtime library in the project options ("Multi-threaded (/MT)"), but then manually add MSVCRT.LIB (part of the dynamic C runtime libary)?
In your library project, check Properties -> C/C++ -> Code Generation -> Runtime Library
Chances are it's set to "Multi Threaded Debug DLL" (/MDd).
If that's the case then try changing it to "Multi Threaded Debug" (/MTd) and rebuild (that worked for me).
The reason for this error depends.
For me it was "libcmt.lib" and "libcmtd.lib" listed explicitly among linker inputs, rather than by selecting it from "Runtime Library" field in GUI.
For me, I was linking to the objects of a static project from a non-static unit test. I tried setting the unit test to static build, but then the compiler (VC++ 2015) got the error An internal error has occurred in the compiler. I ended up setting both the main project and the unit test project to "Use MFC in a Shared DLL", and then it worked.
I have a MFC project which uses C++ Rest SDK (Casablanca) under Visual Studio 2012 to implement an http client connection and it can be compiled well.
Then I add a Microsoft unit test project, but I can’t build the unit test project successfully.
In my main project, the environment is set as “Use MFC in a Static Library”, “No Common Language Runtime Support” and “Multi-threaded Debug (/MTd).” And my test project’s environment is same as main project. The error message shows:
“error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U#YAPAXI#Z) already defined in libcpmtd.lib(newaop.obj).”
In addition, I also try to change the test project’s environment to “Common Language Runtime Support (/clr)” and “Multi-threaded Debug DLL (/MDd).” The original error disappears but new error comes:
“error C1189: #error : is not supported when compiling with /clr or /clr:pure. c:\program files (x86)\microsoft visual studio 11.0\vc\include\atomic line 9”
I do not know how to overcome these problems. Can anyone please give me some suggestions or resolutions? Thanks.
The CRT libraries use weak external linkage for the new, delete functions. The MFC libraries also contain new, delete functions. These functions require the MFC libraries to be linked before the CRT library is linked. Please check http://support.microsoft.com/kb/148652
Solution based on VS2005:
go to project>properties>configuration properties>linker>input
add to "Additional dependency" -> Nafxcwd.lib Libcmtd.lib
add to "ignore specific library" -> Nafxcwd.lib;Libcmtd.lib
I have found that by using NuGet Packmanager to get rest sdk i.e. Search for Casablanca and select cpprestsdk.v140.windesktop. This makes sure all the dlls, libs required are referenced.
Please check:
https://github.com/Microsoft/cpprestsdk/wiki/How-to-use-the-C---Rest-SDK-NuGet-package
http://codename26.rssing.com/chan-8623770/all_p85.html