I use visual studio 2019 to write and compile an app in C++.In the Debug mode it works fine but in the release mode I get errors from the WinToast library:
Error LNK2001 unresolved external symbol __imp__CrtDbgReport {project name} {path}\wintoastlib.obj
Error LNK2001 unresolved external symbol __imp__invalid_parameter {project name} {path}\wintoastlib.obj
Error LNK2001 unresolved external symbol __imp__CrtDbgReportW {project name} {path}\wintoastlib.obj
Error LNK2001 unresolved external symbol __imp__calloc_dbg {project name} {path}\Project {project name}.obj
Error LNK2001 unresolved external symbol __imp__free_dbg {project name} {path}\msvcprtd.lib(locale0_implib.obj)
Error LNK2001 unresolved external symbol __imp__free_dbg {project name} {path}\msvcprtd.lib(filesystem.obj)
Error LNK2001 unresolved external symbol __imp__malloc_dbg {project name} {path}\msvcprtd.lib(locale0_implib.obj)
Error LNK2001 unresolved external symbol __imp__malloc_dbg {project name} {path}\msvcprtd.lib(filesystem.obj)
I tried to put this in my preprocessor definitions:
WIN32_LEAN_AND_MEAN;WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
and here is a list of all libraries I use:
#include <SDL.h>
#include <wintoastlib.h>
#include <iostream>
#include <limits.h>
#include <string>
#include <windows.h>
#include <filesystem>
#include <cstring>
#include <SDL_ttf.h>
#include <SDL_image.h>
#include <chrono>
#include <ctime>
#include <sstream>
#include <iomanip>
I also want to say that I import WinToast lib by inserting the header file and the .cpp file in the Header Files and Source Files. The rest of the libraries I imported by ading them to the include dir, library dir and additional dependecies. I don't know what I did wrong. What settings I miss in the visual studio?
Edit: It still wasn't working before I added that in my preprocessor definitions.
So i find out thanks to the comments that i have the _DEBUG option in the preprocessor definitions:
WIN32_LEAN_AND_MEAN;WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;**_DEBUG**;_CONSOLE;%(PreprocessorDefinitions)
I replaced it with _NDEBUG and it is working again:
WIN32_LEAN_AND_MEAN;WIN32;_CRT_NON_CONFORMING_SWPRINTFS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
Thank you all !!!