I am struggling for hours to build my first Allegro 5 application in Visual Studio 2012, using Windows 7 x64.
I have followed all the steps of this tutorial: http://wiki.allegro.cc/index.php?title=Windows,_Visual_Studio_2010_and_Allegro_5#Download which means that the Allegro directory is in c:/allegro/ and all the libraries are added in both the debug and release configurations.
I also changed my subsystem to Windows, so now it says "Windows (/SUBSYSTEM:WINDOWS)"
1>------ Build started: Project: AllegroTesting, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol __imp__al_install_system referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_rest referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_map_rgb referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_create_display referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_destroy_display referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_flip_display referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__al_clear_to_color referenced in function _main
1>c:\users\skypower\documents\visual studio 2012\Projects\AllegroTesting\Debug\AllegroTesting.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
For anyone wondering, the issue was resolved for skypower in this thread on the allegro.cc forums: Problem installing allegro 5 on vs 2012
It boiled down to specifying the wrong linker input libraries when following the Visual Studio 2010 setup instructions on the relevant Allegro.cc wiki page. Make sure to type the actual version of Allegro instead of typing 5.0.x (i.e. the x should be replaced with the minor version, which is currently 8, so type the version of 5.0.8).
(some extra context if you read that original thread - the x I'm referring was previously a ? in the wiki page's setup instructions)
I struggled with this problem for a long time,pulled half my hair off,and then i finally tried something. I'm using Windows 8 and VS2012 and Allegro 4.2 cause I got it right using the older version.
Link to get the 4.2 binary => http://en.sourceforge.jp/projects/sfnet_alleg/downloads/allegro-bin/4.2.0/allegro-msvc6-4.2.0.zip/
Once you unpack it, there'll be 4 files => bin,include,lib and the readme file.
Copy the include and lib files in C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
Fire up VS and create a Win32 Project,the when prompted with Application setting,check Empty project and click OK.
Insert a source file in and paste this code =>
#include <allegro.h>
int main(void) {
allegro_init();
set_gfx_mode(GFX_SAFE, 640, 480, 0, 0);
install_keyboard();
textout_ex(screen, font, "Hello World!", 1, 1, 10, -1);
textout_ex(screen, font, "Press ESCape to quit.", 1, 12, 11, -1);
while(!key[KEY_ESC]);
allegro_exit();
return 0;
}
END_OF_MAIN()
Now right click on the project in the solution explorer->properties->Linker->Input->Additional Dependencies. Click on it reveal the drop down menu->edit and in the blank space at the top enter 'alleg.lib' ->OK->OK.
Now copy the 3 dll files in the bin folder from the unpacked Allegro 4.2 folder.
Go to where you saved your project, default is my documents->visual studio 2012->projects. go into the folder with your project name->Debug folder. here you will find the .exe file for your project. paste the dll files here.
go to VS2012. press f7 to compile your program,should be no errors. press ctrl+f5 to run.
10.you get a black window saying hello and press esc to exit. That's it! :D
Related
I am working with visual studio 2012 to compile LuaJava. The problem I am having is when I call the linker. The line that calls the linker in the makefile is:
link /dll /LIBPATH:"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64"
/LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64"
/out:luajava-1.1.dll src\c\luajava.obj
"C:\Program Files (x86)\Lua\5.1\lib\lua5.1.lib" /VERBOSE
This seems to almost be linking everything successfully, until it gets to the Lua library.
The linker outputs the following when I try to make the project:
...//linking of other libraries
Finished searching libraries
Unused libraries:
C:\Program Files (x86)\Lua\5.1\lib\lua5.1.lib
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\amd64\OLDNAMES.lib
luajava.obj : error LNK2019: unresolved external symbol lua_close referenced in function Java_org_keplerproject_luajava_LuaState__1close
luajava.obj : error LNK2019: unresolved external symbol lua_newthread referenced in function Java_org_keplerproject_luajava_LuaState__1newthread
luajava.obj : error LNK2019: unresolved external symbol lua_gettop referenced in function Java_org_keplerproject_luajava_LuaState__1getTop
...//lots of these errors
luajava-1.1.dll : fatal error LNK1120: 88 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_amd64\link.EXE"' : return code '0x460'
Stop.
I'm confused as to why it says that the Lua library is unused, and then complains when it can't find the Lua library functions.
You can not link a 32 bit library to your 64 bit application. After some searces I do not believe LuaJava has a x64 download so to use this you must change your application to 32 bit.
Edit:
A second method would be to recomile LuaJava as a 64 bit dll. Here is a very recent post about that: LuaJava compile error "Unresolved external symbol"
I need to compile a project which is automatically created from a simulation programm. I tried to compile it with Microsoft Visual Studio C++ 2010. After converting the project i have the following error LNK2019:
1>libcarmaker.a(DataDict.o) : error LNK2019: unresolved external symbol ___fpclassifyf referenced in function DDictStr2Place
1>libcarmaker.a(DataDict.o) : error LNK2019: unresolved external symbol __fpclassify referenced in function _DDictStr2Place
1>CarMaker.win32.exe : fatal error LNK1120: 2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========,
There are a lot of threads relating to this error but none of those solutions worked for me.
Could anyone help me how to solve it??
fpclassify is supported only in Visual Studio 2012. In VS 2010 it is _fpclass, so you should rename where the function is called.
Source
Summary: Is there any tiny example on how to build the Win32 C++ console application that uses the libgit2 library (sources available at GitHub)?
I have followed the readme and the wiki on how to build the library on Windows using the CMake, and it worked smoothly (only a single unit-test error).
Now, I want to build a simple console application that uses the library -- using Microsoft Visual Studio C++ 2010 (the.vcxproj and the.sln). I have found the general.c code in the libgit2 examples, and I would like to do the same from my C++ application. No success -- I feel really stupid today...
I have noticed there is libqgit2 for C++ and Qt. Is there anything similar for pure C++? Or is there a way to use the C library from C++ application?
Update: I have renamed the general.c to general.cpp, added the libgit2 include path to the project and the path to the .lib files, changed the #include <stdio.h> to #include <cstdio>, and compiled. The following link errors appear:
1>------ Build started: Project: libgit2_general, Configuration: Debug Win32 ------
1>general.obj : error LNK2019: unresolved external symbol _git_repository_free referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_get_string referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_get_int32 referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_config_open_ondisk referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _git_strarray_free referenced in function _main
... etc.
1>general.obj : error LNK2019: unresolved external symbol _git_repository_open referenced in function _main
1>general.obj : error LNK2019: unresolved external symbol _giterr_last referenced in function "void __cdecl check_error(int,char const *)" (?check_error##YAXHPBD#Z)
1>D:\Tutorial\libgit2_general\Debug\libgit2_general.exe : fatal error LNK1120: 56 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This strongly suggests a calling convention mismatch to me. libgit2 uses __stdcall by default, for a number of reasons, while Visual Studio defaults to creating projects that use the __cdecl calling convention. While your program can use either calling convention and successfully call libgit2 using a different one, the easiest solution is probably just to use the same calling convention for both.
When you configure libgit2, you can turn off the STDCALL flag, which will cause it to emit a library built with __cdecl calling conventions:
cmake %PATH_TO_LIBGIT2_SOURCE% -DTHREADSAFE=ON -DSTDCALL=OFF
cmake --build .
It's a little surprising if you generated the project from CMake, bit it could be that you're not linking to libgit2.lib. Make sure you have git2.dll in Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies.
I am trying to learn about DirectX 2010, after setting up the Libraries
how i installed the Libraries:-
VC++ 2010-View-other windows-Property manager
i opened the Microsoft.Cpp.Win32.user
VC++ Directories :-
Include Directories: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
Library Directories: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
here is the Error list i get:-
Error 1 error LNK2019: unresolved external symbol _D3DX10CreateEffectFromFileW#48 referenced in function "long __cdecl InitDevice(void)" (?InitDevice##YAJXZ) c:\Users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\CodeName_Yarab\Main.obj CodeName_Yarab
Error 2 error LNK2019: unresolved external symbol _D3D10CreateDeviceAndSwapChain#32 referenced in function "long __cdecl InitDevice(void)" (?InitDevice##YAJXZ) c:\Users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\CodeName_Yarab\Main.obj CodeName_Yarab
Error 3 error LNK1120: 2 unresolved externals c:\users\ahmed_saad\documents\visual studio 2010\Projects\CodeName_Yarab\Debug\CodeName_Yarab.exe 1 1 CodeName_Yarab
i am using Windows 8 pro x64
It might be that you'll need to link to a .lib-file, because DX ist not among the usual libraries.
Look for a .lib file and add it to your Linker properties.
I am trying to recompile some code I have for a new system. It involves a precompiled static library that I do not have the source code for (just the header), and this library was built with VC++ 6.0 or older with the older runtime libraries. On my old system, which had VC++ 6.0, my program was built and ran fine, but I have recently upgraded things and I no longer have access to VC++ 6.0, only Express 2008 (9.0 w/ SP).
When I build the solution, it compiles but has the following linker error:
1>libcpmtd.lib(xlock.obj) : error LNK2005: "public: __thiscall
std::_Lockit::~_Lockit(void)" (??1_Lockit#std##QAE#XZ) already defined
in NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005:
"public: __thiscall std::bad_cast::bad_cast(char const *)"
(??0bad_cast#std##QAE#PBD#Z) already defined in NOREC.lib(track.obj)
1>LIBCMT.lib(stdexcpt.obj) : error LNK2005: "public: __thiscall
std::bad_cast::bad_cast(class std::bad_cast const &)"
(??0bad_cast#std##QAE#ABV01##Z) already defined in
NOREC.lib(track.obj) 1>LIBCMT.lib(stdexcpt.obj) : error LNK2005:
"public: virtual __thiscall std::bad_cast::~bad_cast(void)"
(??1bad_cast#std##UAE#XZ) already defined in NOREC.lib(track.obj)
1>LINK : fatal error LNK1104: cannot open file 'libcp.lib'
Any ideas how to overcome this issue would be very welcome.
From the last link error, libcp.lib cannot be found. This library has been removed as of VS 2005. Use /MT for the multithreaded version.
http://msdn.microsoft.com/en-us/library/abx4dbyh%28v=vs.80%29.aspx
The multithreaded version is libcpmt.lib which you will get automatically with the /MT flag. I see in the first error you are using libcpmtd.lib which is the debug version of the same. I'm not sure how you are getting that if you are not using /MTd. (or if you are, how libcp.lib is referenced since you should be using one or the other, not both)
The linker is telling you that some symbols are defined more than once. The brute force to convice the linker to produce your target image is to use the /FORCE:MULTIPLE as explained here. I used to use this switch a few times.
LINK : fatal error LNK1104: cannot open file 'libcp.lib'
This is a bug in the linker. Just create an empty file named libcp.lib in the LIBPATH.
libcp.lib you can find in installed MS Visual Studio 6.0 in
c:\Program Files\Microsoft Visual Studio\VC98\Lib\
directory.
Just copy it to your MSVS 2005/2008/2010 lib directory
(i.e. c:\Program Files\Microsoft Visual Studio 8\VC\lib\)
And everything will compiled just fine.