error when compiling a project in VS 2010 C ++ - c++

I'm trying to compile a project that I created, a software management program, in VS 2010. In VS6 and VS2005, it compiles perfectly.
1 - visual studio 6 2 - Visual Studio 2005 3 - Visual Studio 2010
The original version has some bugs that I would like fix later, but first of all I need it to compile.
With VS 6 and VS 2005 it compiles perfectly.
I added the library #pragma comment(lib, "bufferoverflowU.lib") corresponding to each file that needs it (.cpp)
However, it did not solve anything with bufferoverflowU.lib
errors are:
1>------ Operación Volver a generar todo iniciada: proyecto: Gestion_v1, configuración: Release Win32 ------
1> StdAfx.cpp
1> WDoS.cpp
1> Helpers.cpp
1> Gestion.cpp
1> WWW.cpp
1>WWW.cpp(141): warning C4018: '<' : no coinciden signed/unsigned
1>WWW.cpp(136): warning C4101: 'dwTmp' : variable local sin referencia
1>WWW.cpp(481): warning C4244: '=' : conversion from 'DWORD' to 'char'; possible loss of data
1>WWW.cpp(482): warning C4244: '=' : conversion from 'DWORD' to 'char'; possible loss of data
1> Generando código...
1>LINK : warning LNK4108: /ALIGN specified without /DRIVER; image may not run
1>WDoS.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "unsigned long __stdcall WDoS_HTTP(void *)" (?WDoS_HTTP##YGKPAX#Z)
1>Gstion.obj : error LNK2001: unresolved external symbol ___security_cookie
1>WWW.obj : error LNK2001: unresolved external symbol ___security_cookie
1>WDoS.obj : error LNK2019: unresolved external symbol #__security_check_cookie#4 referenced in function "unsigned long __stdcall WDoS_HTTP(void *)" (?WDoS_HTTP##YGKPAX#Z)
1>Gestion.obj : error LNK2001: unresolved external symbol #__security_check_cookie#4
1>WWW.obj : error LNK2001: unresolved external symbol #__security_check_cookie#4
1>.\Release/Gestion_v1.exe : fatal error LNK1120: 2 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Any ideas?
Thanks

Your unresolved externals are a consequence of compiling with the /GS (Buffer Security Check) compiler flag, but not linking against the CRT (/NODEFAULTLIB). If /GS is not specified it defaults to being enabled. You can try to disable Buffer Security Checks by specifying /GS-.
Alternatively you can attempt to add the pieces of code you need. __security_cookie is declared in <process.h> and defined in <gs_cookie.c> as part of the CRT source that ships with Visual Studio. Since you also explicitly specified WinMain as the entry point and don't rely on the CRT to perform the required initialization you will have to call __security_init_cookie yourself. There may be more to get this to compile, but this should serve as a starting point.

Make sure your project is not set to unicode. Your library may be that is different.
Try : Project properties -> Configuration properties -> General -> Character set = not set
Ok, try this question :
error LNK2001: unresolved external symbol

Related

How to solve 'error LNK2001: unresolved external symbol' for writing a User-defined Model (FLAC) in Visual Studio 2010 C++?

I am trying to write a User-defined Model in C++ for FLAC in Visual Studio Express 2010 C++. Initially, I am trying to run (debug and build) the built-in Strain-softening Model based on the Mohr-Coulomb criterion (Available in FLAC 8.0) by changing its name only. Once I succeed to do it, I will try to modify it as per my requirement. I am running the code in VS2010. I have already installed SDK7.1, VS2010 SP1, etc. However, I am getting the following error msg:
1>------ Build started: Project: i_ssoft, Configuration: Debug x64 ------
1> modeli_ssoft.cpp
1> Creating library C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.lib and object C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\i_ssoft.exp
1>modeli_ssoft.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl models::ConstitutiveModel::getPluginName(void)const " (?getPluginName#ConstitutiveModel#models##UEBA?AV?$basic_string#_WU?$char_traits#_W#std##V?$allocator#_W#2##std##XZ)
1>C:\Program Files\Itasca\FLAC800\PluginFiles\Models\modeli_ssoft\i_ssoft\\i_ssoft.dll : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
From the error code, it is clear that I need to add some libraries or I need to place the supporting libraries in the same project directory... which I have tried but still, I am getting the error.

Can't play audio with STATIC linked SFML

I am making a simple Pong game and after finishing the game I tried to add a sound effect for the ball collision but the compiler would not compile the code and send some errors I made sure that openal32 is linked and the .dll is in the directory of the project. So I would write the whole game without a problem and as soon as I include
buf.loadFromFile("data\pong.wav");
Sound sound;
sound.setBuffer(buf);
The compiler won't even start the game and would give me those errors,I am using SFML 2.5.1 after compiling it for visual studio 2019 that I am using.
1>------ Build started: Project: Project1, Configuration: Debug x64 ------
1>Source.cpp
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(69,19): warning C4129: 'p': unrecognized character escape sequence
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(133,19): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(137,20): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(141,20): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(151,19): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(155,20): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(159,20): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(164,21): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>C:\Users\Ahmad.T\source\repos\Project1\Project1\Source.cpp(164,13): warning C4244: 'argument': conversion from 'int' to 'float', possible loss of data
1>flac.lib(stream_decoder.obj) : error LNK2019: unresolved external symbol __iob_func referenced in function FLAC__stream_decoder_reset
1>flac.lib(stream_encoder.obj) : error LNK2001: unresolved external symbol __iob_func
1>flac.lib(win_utf8_io.obj) : error LNK2001: unresolved external symbol __iob_func
1>flac.lib(bitreader.obj) : error LNK2019: unresolved external symbol fprintf referenced in function FLAC__bitreader_dump
1>flac.lib(bitwriter.obj) : error LNK2001: unresolved external symbol fprintf
1>flac.lib(win_utf8_io.obj) : error LNK2019: unresolved external symbol vsnprintf_s referenced in function local_vsnprintf
1>MSVCRTD.lib(vsnprintf_s.obj) : error LNK2001: unresolved external symbol vsnprintf_s
1>MSVCRTD.lib(vsnprintf_s.obj) : error LNK2001: unresolved external symbol _vsnprintf_s
1>C:\Users\Ahmad.T\source\repos\Project1\x64\Debug\Project1.exe : fatal error LNK1120: 4 unresolved externals
1>Done building project "Project1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here are the libraries that are linked to the project:
flac.lib
opengl32.lib
openal32.lib
freetype.lib
winmm.lib
gdi32.lib
vorbisenc.lib
vorbisfile.lib
vorbis.lib
ogg.lib
ws2_32.lib
sfml-graphics-s-d.lib
sfml-window-s-d.lib
sfml-system-s-d.lib
sfml-audio-s-d.lib
sfml-network-s-d.lib
If you need a further look on the code I will include it in a comment if needed.
I think you used the wrong compiler. As SFML depends on a big number of underlying libraries (flac.lib is only one example..). These libraries are part of the download. However these libraries need to be used with the same compiler they were build.
That is why SFML is offering Downloads for different visual studio versions.
Between the versions Microsoft changed header definitions so now functions are defined different than in the delivered libraries(basically the header files changed between the different Visual Studio versions).
You may have success by
using the legacy_stdio_definitions.lib to resolve the issues
recompile all dependencies in your current compiler (or search for them to download)
switch back to supported Visual Studio 2015
See this answer for a similar problem

gmp.h /mpir.h linker in visual studio 2012 professional

I am trying to use gmp.h for C/C++. I am currently working on visual studio 2012 professional. I followed the instructions from the link. But still I got error messages...
1>------ Build started: Project: final, Configuration: Debug Win32 ------
1> final.cpp
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_init_set_ui referenced in function _wmain
1>final.obj : error LNK2019: unresolved external symbol ___gmpz_out_str referenced in function _wmain
1>D:\New folder\final\Debug\final.exe : fatal error LNK1120: 3 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I tried all possible options but could not got the solution. Please help me out
I had the same problem and it was just that I wasn't linking the library.
You need to include the library in the Visual Studio project.
How to add additional libraries to Visual Studio project?

Boost compile error with VS 2008 but not 2010 or 2012

I am wondering if it is possible to compile the boost chat client example found here (the example with the 3 files: chat_message.hpp, chat_client.cpp, and chat_server.cpp):
http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/examples.html
with VS 2008 compiler? It compiles with 2012, but not 2008 or 2010. I am using boost version 1_51
I'm compiling it from within VS 2012 but using the platform toolset for VS 2008. When i change the compiler to 2008, all of a sudden the namespace line (in chat_client.cpp) gets underlined in red by intellisense:
using boost::asio::ip::tcp;
I haven't been able to figure out what it is that is causing the 2008 compiler to fail and if there is some way to get around this (perhaps using an older version of boost?).
This is the output I get when I compile with 2008 (with #define BOOST_LIB_DIAGNOSTIC):
1> Linking to lib file: libboost_system-vc90-mt-1_51.lib
1> Linking to lib file: libboost_date_time-vc90-mt-1_51.lib
1> Linking to lib file: libboost_regex-vc90-mt-1_51.lib
1> Linking to lib file: libboost_thread-vc90-mt-1_51.lib
1> Linking to lib file: libboost_chrono-vc90-mt-1_51.lib
1>c:\users\dustin\documents\boostexamples\boostchatclientexample\chat_message.hpp(70): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\string.h(144) : see declaration of 'strncat'
1>c:\users\dustin\documents\boostexamples\boostchatclientexample\chat_message.hpp(84): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(366) : see declaration of 'sprintf'
1>chat_client.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::detach(void)" (?detach#thread#boost##QAEXXZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::join(void)" (?join#thread#boost##QAEXXZ)
1>chat_client.obj : error LNK2001: unresolved external symbol "private: void __thiscall boost::thread::start_thread(void)" (?start_thread#thread#boost##AAEXXZ)
1>C:\Users\dustin\Documents\BoostExamples\BoostChatClientExample\Release\BoostChatClientExample.exe : fatal error LNK1120: 5 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

C++ project not compiling

I created an empty c++ console application with visual studio 2010 and dragged and dropped the source files from http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear.aspx but when I click on rebuild I get a load of errors which dont direct me anywhere in the source... The executable provided with the source works fine So can you please check it out and tell me what am I missing.
update:
Error 1 error LNK2001: unresolved external symbol _AvRevertMmThreadCharacteristics#4 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\loopback-capture.obj tr
Error 2 error LNK2001: unresolved external symbol __imp__mmioWrite#12 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\loopback-capture.obj tr
Error 3 error LNK2001: unresolved external symbol __imp__mmioCreateChunk#12 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\loopback-capture.obj tr
Error 4 error LNK2001: unresolved external symbol __imp__mmioAscend#12 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\loopback-capture.obj tr
Error 5 error LNK2001: unresolved external symbol _AvSetMmThreadCharacteristicsW#8 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\loopback-capture.obj tr
Error 6 error LNK2001: unresolved external symbol __imp__mmioOpenW#12 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\main.obj tr
Error 7 error LNK2001: unresolved external symbol __imp__mmioClose#8 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\main.obj tr
Error 8 error LNK2001: unresolved external symbol __imp__mmioDescend#16 c:\Users\Admin\documents\visual studio 2010\Projects\tr\tr\main.obj tr
Error 9 error LNK1120: 8 unresolved externals c:\users\admin\documents\visual studio 2010\Projects\tr\Release\tr.exe tr
Well if you check in your source folder, you'll see that there are a few libraries that must be linked to:
TARGETLIBS = \
$(SDK_LIB_PATH)\avrt.lib \
$(SDK_LIB_PATH)\ole32.lib \
$(SDK_LIB_PATH)\winmm.lib \
In this particular case, you will want to go into your VS2010 settings for the project you've created and include these files. I believe the option will fall under Additional Dependencies, although I don't have VS2010 handy to double check.
I believe in the neighborhood of Properties > C++ > Linker > Additional Dependencies
That may not be exact, but it should get you close to where you need to be. You'll need to include avrt.lib, ole32.lib, winmm.lib.