I am trying to use the libnoise library, which is a c++ library for perlin noise generation, in Visual Studio 2013. Tutorial 3 links to an addon utility called noiseutils, which consists of a .cpp and a .h, which I place here:
I have the project settings pointed towards the include folder (whose contents are in the image below), and my code looks like this.
#include "stdafx.h"
#include <noise/noise.h>
#include "noiseutils.h"
int _tmain(int argc, _TCHAR* argv[])
{
noise::module::Perlin myModule;
utils::NoiseMap heightMap;
utils::NoiseMapBuilderPlane heightMapBuilder;
heightMapBuilder.SetSourceModule(myModule);
heightMapBuilder.SetDestNoiseMap(heightMap);
heightMapBuilder.SetDestSize(256, 256);
heightMapBuilder.SetBounds(2.0, 6.0, 1.0, 5.0);
heightMapBuilder.Build();
utils::RendererImage renderer;
utils::Image image;
renderer.SetSourceNoiseMap(heightMap);
renderer.SetDestImage(image);
renderer.Render();
utils::WriterBMP writer;
writer.SetSourceImage(image);
writer.SetDestFilename("tutorial.bmp");
writer.WriteDestFile();
return 0;
}
All of that code is given in the third tutorial provided on their website. Visual Studio has no complaints that it cannot find any of the classes or functions specified in all of this code. However, when I try to build the project...
1>------ Build started: Project: libnoisetest, Configuration: Debug Win32 -- ----
1> libnoisetest.cpp
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.h(1217): warning C4244: 'initializing' : conversion from 'const double' to 'float', possible loss of data
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::GradientColor::~GradientColor(void)" (??1GradientColor#utils#noise##QAE#XZ) referenced in function "public: __thiscall noise::utils::RendererImage::~RendererImage(void)" (??1RendererImage#utils#noise##QAE#XZ)
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::NoiseMap::NoiseMap(void)" (??0NoiseMap#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::NoiseMap::~NoiseMap(void)" (??1NoiseMap#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::Image::Image(void)" (??0Image#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::Image::~Image(void)" (??1Image#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: void __thiscall noise::utils::WriterBMP::WriteDestFile(void)" (?WriteDestFile#WriterBMP#utils#noise##QAEXXZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::NoiseMapBuilderPlane::NoiseMapBuilderPlane(void)" (??0NoiseMapBuilderPlane#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall noise::utils::NoiseMapBuilderPlane::Build(void)" (?Build#NoiseMapBuilderPlane#utils#noise##UAEXXZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: __thiscall noise::utils::RendererImage::RendererImage(void)" (??0RendererImage#utils#noise##QAE#XZ) referenced in function _wmain
1>libnoisetest.obj : error LNK2019: unresolved external symbol "public: void __thiscall noise::utils::RendererImage::Render(void)" (?Render#RendererImage#utils#noise##QAEXXZ) referenced in function _wmain
1>B:\Visual Studio\_Projects\libnoisetest\Debug\libnoisetest.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
In short, Visual Studio can't find any of the stuff in "noiseutils" while it's actually building. What am I doing wrong here?
UPDATE:
After copying noiseutils.cpp to my source folder as suggested by Praetorian, I get this set of warnings, and a single error:
1>------ Build started: Project: libnoisetest, Configuration: Debug Win32 ------
1> noiseutils.cpp
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.cpp(24): warning C4627: '#include <fstream>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.cpp(26): warning C4627: '#include <noise/interp.h>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.cpp(27): warning C4627: '#include <noise/mathconsts.h>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.cpp(29): warning C4627: '#include "noiseutils.h"': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>b:\visual studio\extra libraries\libnoise\include\noiseutils.cpp(1303): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I looked up this problem and discovered that I can simply disable using precompiled headers for noiseutils.cpp since it doesn't need access to stdafx. With that, problem solved.
Out of curiosity though, what is stdafx and what role does it play in a Visual Studio project? Would I need to disable precompiled headers for any source code that I add to my project so that it ignores stdafx?
Right click -> Proprieties -> C++ -> Additional Include Directories and add your headers location
Right click -> Add -> Existing Item -> Add your files
If you want
Right click -> Add -> New Filter and you put the files there
Related
I am trying to use the detours library in a visual studio empty windows project. I cloned the repository (https://github.com/microsoft/Detours), I added the include directory into Project Properties / C/C++ / Additional Include Directories, and I added the lib.X86 directory into Project Properties / Linker / Additional Library Directories. I get no errors visible on the file, but when I build I get
1>Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionBegin#0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourTransactionCommit#0 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourUpdateThread#4 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourAttach#8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourDetach#8 referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol _DetourRestoreAfterWith#0 referenced in function _main
1>C:\Users\colel\source\repos\Project3\Debug\Project3.exe : fatal error LNK1120: 6 unresolved externals
1>Done building project "Project3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped =========
Which looks like the library wasn't included correctly. How do I properly include the detours library into a visual studio project and what am I doing wrong?
You need to add the specific .lib file, which I'm guessing is "detours.lib" (or similar) to the "Additional Dependencies" line.
Properties->Linker->Input->Additional Dependencies.
83
Back-ends: imgui_impl_dx9.cpp + imgui_impl_win32.cpp
Operating System: Windows 10
Compiler: Visual Studio 2019
My Issue/Question:
I keep getting constant linker errors when trying to compile my program and I cannot figure out what is causing them
I have the files required and they're included in the .sln properties and in my main.cpp
1>------ Build started: Project: ConsoleApplication2, Configuration: Debug Win32 ------
1>ConsoleApplication2.cpp
1>imgui_widgets.cpp
1>Generating Code...
1>ConsoleApplication2.obj : error LNK2019: unresolved external symbol _Direct3DCreate9#4 referenced in function "bool __cdecl CreateDeviceD3D(struct HWND__ *)" (?CreateDeviceD3D##YA_NPAUHWND__###Z)
1>imgui_impl_win32.obj : error LNK2019: unresolved external symbol _XInputGetState#8 referenced in function "void __cdecl ImGui_ImplWin32_UpdateGamepads(void)" (?ImGui_ImplWin32_UpdateGamepads##YAXXZ)
1>imgui_impl_win32.obj : error LNK2019: unresolved external symbol _XInputGetCapabilities#12 referenced in function "void __cdecl ImGui_ImplWin32_UpdateGamepads(void)" (?ImGui_ImplWin32_UpdateGamepads##YAXXZ)
1>C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64\xinput.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
1>C:\Users\Logan\source\repos\ConsoleApplication2\Debug\ConsoleApplication2.exe : fatal error LNK1120: 3 unresolved externals
1>Done building project "ConsoleApplication2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm trying to compile Ogre Wiki Tutorial Framework 1.9 - (Windows line endings) in VisualStudio 2013. Right click on OgreFramework project and choosing Rebuild returns following errors:
Error 487 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::windowClosed(class Ogre::RenderWindow *)" (?windowClosed#BaseApplication##MAEXPAVRenderWindow#Ogre###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 488 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::windowResized(class Ogre::RenderWindow *)" (?windowResized#BaseApplication##MAEXPAVRenderWindow#Ogre###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 489 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mouseReleased(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" (?mouseReleased#BaseApplication##MAE_NABVMouseEvent#OIS##W4MouseButtonID#3##Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 490 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mousePressed(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" (?mousePressed#BaseApplication##MAE_NABVMouseEvent#OIS##W4MouseButtonID#3##Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 491 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mouseMoved(class OIS::MouseEvent const &)" (?mouseMoved#BaseApplication##MAE_NABVMouseEvent#OIS###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 492 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::keyReleased(class OIS::KeyEvent const &)" (?keyReleased#BaseApplication##MAE_NABVKeyEvent#OIS###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 493 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::keyPressed(class OIS::KeyEvent const &)" (?keyPressed#BaseApplication##MAE_NABVKeyEvent#OIS###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 494 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::frameRenderingQueued(struct Ogre::FrameEvent const &)" (?frameRenderingQueued#BaseApplication##MAE_NABUFrameEvent#Ogre###Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 495 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::loadResources(void)" (?loadResources#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 496 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createResourceListener(void)" (?createResourceListener#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 497 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::setupResources(void)" (?setupResources#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 498 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createViewports(void)" (?createViewports#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 499 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::destroyScene(void)" (?destroyScene#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 500 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createFrameListener(void)" (?createFrameListener#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 501 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createCamera(void)" (?createCamera#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 502 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::chooseSceneManager(void)" (?chooseSceneManager#BaseApplication##MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 503 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::configure(void)" (?configure#BaseApplication##MAE_NXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 504 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::setup(void)" (?setup#BaseApplication##MAE_NXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 505 error LNK2001: unresolved external symbol "public: virtual void __thiscall BaseApplication::go(void)" (?go#BaseApplication##UAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 506 error LNK2001: unresolved external symbol "public: virtual __thiscall BaseApplication::~BaseApplication(void)" (??1BaseApplication##UAE#XZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 507 error LNK2001: unresolved external symbol "public: __thiscall BaseApplication::BaseApplication(void)" (??0BaseApplication##QAE#XZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 508 error LNK1120: 21 unresolved externals C:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\Release\OgreFramework.exe OgreFramework
But when I do this it works:
Right click on BaseApplication.cpp file and choosing Compile:
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1> BaseApplication.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Right click on TutorialApplication.cpp file and choosing Compile:
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1> TutorialApplication.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Right click on OgreFramework project and choosing Build
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1>Release\BaseApplication.obj : warning LNK4042: object specified more than once; extras ignored
1> Generating code
1> Finished generating code
1> OgreFramework.vcxproj -> C:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\Release\OgreFramework.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Both *.h files have set Configuration Properties -> General -> Item Type shows: C/C++ header
Both *.cpp files have set Configuration Properties -> General -> Item Type shows: C/C++ compiler
I've tried remove and add *.h files to project as mentioned in this post but I got same errors. Mentioned post also says that those errors can be found in some log but I cannot find it. Thanks
EDIT:
BaseApplication.cpp or TutorialApplication.cpp -> Right click -> Properties -> Configuration Properties -> C/C++ -> Output Files -> Object File Name shows: $(IntDir)
OgreFramework project -> Right click -> Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories -> <edit> -> Macros -> $(IntDir) shows:
Debug\
Problem solved. I had also included in a solution explorer filter which contained other version of BaseApplication.cpp and BaseApplication.cpp (because I've copied project and not created new one) which caused overwriting my original BaseApplication.cpp and BaseApplication.h. All credit goes to #HansPassant.
I am a newbie to C++. I want to use, lacewing-project.org in my C++ project. I read the documentation on how to build it and successfully did it using both DLL - Release and Static Library - Release configurations.
Now I don't know how to use this in my project and how to setup and configure my project? I was following this tutorial, but was stuck in the middle because of missing options in the latest Visual Studio. I use Visual C++ Expression Ed., 2012 on Windows 8
I googled and did the following:
Added the lib file and the lacewing.h file in my project.
Under Visual C++ Project Properties, in the Linker folder -> Input I added the lib file as Additional Dependencies.
I placed the dll in Windows\System32 folder. Will I need to do anything with the dll other than placing it in win32 folder?
My code is from the hello world example given in the documentation.
When I try to compile I get:
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol __imp__lw_version referenced in function "void __cdecl on_get(struct lacewing::_webserver *,struct lacewing::_webserver_request *)" (?on_get##YAXPAU_webserver#lacewing##PAU_webserver_request#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl lacewing::pump_delete(struct lacewing::_pump *)" (__imp_?pump_delete#lacewing##YAXPAU_pump#1##Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct lacewing::_error * __thiscall lacewing::_eventpump::start_eventloop(void)" (__imp_?start_eventloop#_eventpump#lacewing##QAEPAU_error#2#XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct lacewing::_eventpump * __cdecl lacewing::eventpump_new(void)" (__imp_?eventpump_new#lacewing##YAPAU_eventpump#1#XZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl lacewing::_stream::writef(char const *,...)" (__imp_?writef#_stream#lacewing##QAAXPBDZZ) referenced in function "void __cdecl on_get(struct lacewing::_webserver *,struct lacewing::_webserver_request *)" (?on_get##YAXPAU_webserver#lacewing##PAU_webserver_request#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall lacewing::_webserver::host(long)" (__imp_?host#_webserver#lacewing##QAEXJ#Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall lacewing::_webserver::on_get(void (__cdecl*)(struct lacewing::_webserver *,struct lacewing::_webserver_request *))" (__imp_?on_get#_webserver#lacewing##QAEXP6AXPAU12#PAU_webserver_request#2##Z#Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct lacewing::_webserver * __cdecl lacewing::webserver_new(struct lacewing::_pump *)" (__imp_?webserver_new#lacewing##YAPAU_webserver#1#PAU_pump#1##Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl lacewing::webserver_delete(struct lacewing::_webserver *)" (__imp_?webserver_delete#lacewing##YAXPAU_webserver#1##Z) referenced in function _main
1>C:\Users\Jayarathina\Desktop\New folder (3)\test\Debug\test.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please help...
To link statically with the library, one must define lw_import. If you don't do this, it will default to __declspec(dllimport):
#ifndef lw_import
#define lw_import __declspec (dllimport)
#endif
which causes the linker to try and pull the functions in from a DLL (which is wrong when statically linking). To do this, you can either add lw_import= to your preprocessor definitions in the project properties, or #define it before including lacewing.h, as so:
#define lw_import
#include <lacewing.h>
As you're statically linking the library, you will also need to link any library dependencies into your own project. You can find the list in the project properties of liblacewing.vcproj itself, but as of 0.5.1 these are ws2_32.lib, mswsock.lib, mpr.lib, secur32.lib and crypt32.lib.
I am currently working on converting some of my applications to C++, and for that i have decided to use openGL, as ive got some experience with it from other platforms.
But getting this to compile in x64 seems to be quite a lot of hassle. To check if my linking stuff is working i am just trying to compile this tutorial:
http://www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/
But as you can see, i failed miserably. I have downloaded and installed:
freeglut
GLM
GLFW
GLEW
The issue clearly seems to lay within GLFW. I am using Visual express c++ 2010.
I installed GLFW like this:
GLFW.dll (System32)
glfw.h (C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\gl)
GLFW.lib (C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64)
GLFWDLL.lib (C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64)
My linker:
kernel32.lib;glu32.lib;glew32.lib;GLFW.lib;GLFWDLL.lib;opengl32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
Output:
1>------ Build started: Project: Spacecraft, Configuration: Debug x64 ------
1> Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwGetWindowParam referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwGetKey referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwSwapBuffers referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwEnable referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwSetWindowTitle referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwTerminate referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwOpenWindow referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwOpenWindowHint referenced in function main
1>Main.obj : error LNK2019: unresolved external symbol __imp_glfwInit referenced in function main
1>c:\users\leif andreas\documents\visual studio 2010\Projects\Spacecraft\x64\Debug\Spacecraft.exe : fatal error LNK1120: 9 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
And finally, my includes:
// Include standard headers
#include <stdio.h>
#include <stdlib.h>
// Include GLEW
#include <gl/glew.h>
#include <gl/glut.h>
// Include GLFW
#include <gl/glfw.h>
// Include GLM
#include <glm/glm.hpp>
using namespace glm;