Allegro Installation - allegro5

I've been trying to install allegro 5 into MSVS 2015 for 3 hours now, and have seen many tutorials, none of which helped me. I am using the code on the tutorial wiki to just make a screen.
#include "windows.h"
#include <stdio.h>
#include <allegro5/allegro.h>
int main(int argc, char **argv)
{
ALLEGRO_DISPLAY *display = NULL;
if (!al_init()) {
fprintf(stderr, "failed to initialize allegro!\n");
return -1;
}
display = al_create_display(640, 480);
if (!display) {
fprintf(stderr, "failed to create display!\n");
return -1;
}
al_clear_to_color(al_map_rgb(0, 0, 0));
al_flip_display();
al_rest(10.0);
al_destroy_display(display);
return 0;
}
This is the error I get.
1>------ Build started: Project: Project7, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol _al_rest referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_map_rgb referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_create_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_destroy_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_flip_display referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_clear_to_color referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _al_install_system referenced in function _main
1>c:\users\jacob\documents\visual studio 2015\Projects\Project7\Debug\Project7.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Anything helps, thanks.

Unresolved external symbol implies a compile-time linker error. When you downloaded Allegro, it will have come with a collection of resources:
includes (.h/.hpp): These are header files which define what functions exist within the library, but will not actually contain the function code themselves.
libraries (.lib): These files contain pre-compiled code and need to be linked to your project.
dlls (.dll): DLLs aren't always used when you have other library resources, however they support runtime linkage and need to be distributed with your application in order for it to run correctly.
Linker Errors
You are most likely missing a link to your libraries. In Visual studio, you can add references to libraries by right clicking on your project in the solution explorer and navigating to the linker section.
You will need to add the path to the "lib" folder in your allegro download. This can be done by adding the filepath to the additional library dependencies field.
Hope this helps!

Related

unresolved symbols after converting VS2012 Windows 8 Metro solution to VS2013 (on Windows 8.1)

I have a question, which I'm currently unable to tackle effectively since I'm still unfamiliar with Metro app development. So please bear with me :)
Long story short, I have a large, complex VS2012 Metro app managed+native solution (currently built on Windows 8) into VS2013 targeting Windows 8.1.
I imported the solution into VS2013 (hosted on Windows 8.1), and run the conversion for it and all the sub projects therein. Stuff compile, but it is with the linker that we run into problems. This is an example of the linker errors we get:
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol _getenv referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___beginthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___endthreadex referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsrchr referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___mbsnbicmp referenced in function <blahblahblah>
error LNK2019: unresolved external symbol __imp___dupenv_s referenced in function <blahblahblah>
The thing is that for every single symbol that is 'missing', we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs.
Any ideas why this is happening? Thanks.
we can see the that the declaration is present in the MS Windows header files supplied with VS2013. Inspecting the references in each sub-project shows that they are referencing the Windows 'core' libs
It is going to be difficult to diagnose what went wrong with this little information, but it is pretty clear that you are looking in the completely wrong corner for this problem. The missing symbols are not Windows api functions, they are C runtime support functions. They are only used in a C++ project, you've been looking at .NET projects.
So you'll need to focus on the one project that generates these linker errors, it is a C++ project. The linker command that's issued to get it to link to the .lib that has these symbols is completely automagic so there isn't much that can go wrong. The very first thing to do is to force a complete rebuild so it won't use outdated .obj and .lib files that were left over from a previous build in VS2012. Right-click the project and choose Rebuild.
And it is worth taking a look at the .vcxproj file for this project with a text editor (like Notepad) and ensure that the conversion went properly and made the correct changes:
the ToolsVersion property must be changed from "4.0" to "12.0"
the MinimumVisualStudioVersion property must be changed from 11.0 to 12.0
two new properties are added, ApplicationType (Windows Store) and ApplicationTypeRevision (8.1)
every configuration's PlatformToolset property must be changed from v110 to v120
There is a log file in the Debug\projectname.tlog directory named link.read.1.tlog that contains diagnostics, it shows all the .lib files that the linker uses. It must contain this line:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 12.0\VC\LIB\STORE\VCCORLIBD.LIB
Which is the .lib file that contains these symbols.

c++ mex file in matlab

I am trying to call a c++ function from matlab using a mex file.
While compiling any example mex programs given in the <root>\extern\examples\mex folder I get the same error:
Creating library C:\USERS\SONY\APPDATA\LOCAL\TEMP\MEX_AA~1\templib.x and object C:\USERS\SONY\APPDATA\LOCAL\TEMP\MEX_AA~1\templib.exp
arrayProduct.obj : error LNK2001: unresolved external symbol _fltused
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
arrayProduct.mexw64 : fatal error LNK1120: 2 unresolved externals
I am using matlab 7.8(2009a) and compiler microsoft visual studio express 2008.
Can someone please help me?
Thanks.

convert first.obj to first.exe

please I would like you to answer me about that error when I compiled my C program(VC++ 2008) Thank you very, I would appreciate any help ..
Note :my program is to perform cosimulation between OPNET modeler 14.5 and MATLAB by using external cosimulation controller C program ....
this is output error in VC++ 2008 command prompt
`first.c
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:first.exe
first.obj
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Interface_Value_Set
$referenced in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Interface_Value
$_Get referenced in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Execute_Until r
$eferenced in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Interface_Callb
$ack_Register referenced in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Interface_Group
$_Get referenced in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Load referenced
$ in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Init referenced
$ in function _main
$first.obj : error LNK2019: unresolved external symbol _imp_Esa_Main referenced
$ in function _main
$first.exe : fatal error LNK1120: 8 unresolved externals`
I guess you'd better use command-line tools(such as makesim) provided by OPNET rather than Visual Studio. Since your cosim depends on OPNET headers and libraries, it is better to compile and link with OPNET toolchain.

Yet another LNK2019: unresolved external symbol

I'm creating a backbone for a school project, but I'm running into "unresolved external symbol" errors. According to previous problems mentioned on this site, I think have to manually link my project to a .lib file. Problem is, I don't know exactly which .lib I need to link to. Can someone explain like I'm twelve?
1>------ Build started: Project: Birthday311, Configuration: Debug Win32 ------
1>Build started 2/2/2012 07:55:30 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Birthday311.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getDay(void)const " (?getDay#Birthday##QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor##YAXAAVTester###Z)
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getMonth(void)const " (?getMonth#Birthday##QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor##YAXAAVTester###Z)
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Birthday::getName(void)const " (?getName#Birthday##QBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor##YAXAAVTester###Z)
1>C:\Users\Ender\Documents\Visual Studio 2010\Projects\Birthday311\Debug\Birthday311.exe : fatal error LNK1120: 3 unresolved externals
Seems like you didn't actually implement the functions getDay, getMonth, and getName.

Link error when calling RUNTIME_CLASS on new class

I have a Visual Studio 2010 project done on MFC. I receive these errors:
2>COrderContentsItemsDocument.obj : error LNK2028: unresolved token (0A0001CA) "public: static struct CRuntimeClass * __stdcall COrderContentsItem::GetThisClass(void)" (?GetThisClass#COrderContentsItem##$$FSGPAUCRuntimeClass##XZ) referenced in function "public: virtual struct CRuntimeClass * __thiscall COrderContentsItemsDocument::GetItemsRuntimeClass(void)" (?GetItemsRuntimeClass#COrderContentsItemsDocument##$$FUAEPAUCRuntimeClass##XZ)
2>COrderContentsItemsDocument.obj : error LNK2019: unresolved external symbol "public: static struct CRuntimeClass * __stdcall COrderContentsItem::GetThisClass(void)" (?GetThisClass#COrderContentsItem##$$FSGPAUCRuntimeClass##XZ) referenced in function "public: virtual struct CRuntimeClass * __thiscall COrderContentsItemsDocument::GetItemsRuntimeClass(void)" (?GetItemsRuntimeClass#COrderContentsItemsDocument##$$FUAEPAUCRuntimeClass##XZ)
2>..\..\Output\Win32\Debug_Unicode\MindSalesManager.exe : fatal error LNK1120: 2 unresolved externals
After some research, I disocovered,that the problem comes when I call
RUNTIME_CLASS(COrderContentsItem)
So, this class is a new one that I copied from another already existing. So I am wondering to discover what is the problem.
Cheers,
Sérgio
The solution is to change the COrderContentsItem.cpp file properties. On solution Explorer, right-click the file, Choose Properties, and in Configration Properties > General change the Item type from "C/C++ header" to "C/C++ compiler".
May be I did something wrong when creating the file, e. g. choosing .h file instead of .cpp file.