Visual Studio 2017 Set Up Issues

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Hephaestus
Posts: 4
Joined: Sun Feb 11, 2018 11:48 pm
Location: Mount Olympus

Visual Studio 2017 Set Up Issues

Post by Hephaestus »

I have been trying to set up visual studio 2017 for some testing on the Irrlicht engine and after some trials I have not been able to get running.

I was using this video to guide me: https://www.youtube.com/watch?v=U9qnA49YSXg

Here is what I have done:
1. Downloaded Irrlicht
2. Created a Win32 equivalent project (unsure)
2. Linked include and lib folders
3. Inserted general code to be able to run an Irrlicht program (taken from documentation page)
4. Placed the 'irrlicht.dll' file inside multiple folders (like Release and Debug)
5. Pretty much placed the dll file in every folder inside the "solution"
6. Only received an error
7. And deleted the project
8. Wallowed in defeat

The most important thing I could get from the error message was that I had 2 unresolved externals and the "createdevice" in my main.cpp file was creating an error.
Should you need it, I can quickly recreate the project and get you the error message.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Visual Studio 2017 Set Up Issues

Post by CuteAlien »

Sorry, not enough time right now to watch youtube (just typing quickly before lunch). But some notes:
- You are likely better of using a Win64 project, thought Win32 should also still work.
The unresolved error means it doesn't find Irrlicht.lib, it's not about Irrlicht.dll. Windows is like that - it creates a tiny lib file for link-time which also has to be found. Usually you add that in linker-input, but VS also has some pragmas which the Irrlicht examples use a lot and can be added directly in the code:
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif

Make sure your linker path is set to that Irrlicht.lib file. It's in lib\Win64-visualStudio or in lib\Win32-visualStudio (depending if you compiled for Win32 or Win64).

You also have to be careful to compile not the static versions (those also can be made to work but start with dll's).

Last - please always copy-paste the _exact_ errors in the forum. Otherwise you might leave out just the information we need to help you.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Hephaestus
Posts: 4
Joined: Sun Feb 11, 2018 11:48 pm
Location: Mount Olympus

Re: Visual Studio 2017 Set Up Issues

Post by Hephaestus »

I did what you asked. Here:
New Error:

Code: Select all

 
1>------ Build started: Project: IrrTest, Configuration: Debug Win32 ------
1>MSVCRTD.lib(exe_winmain.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>C:\Users\Admin\source\repos\IrrTest\Debug\IrrTest.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "IrrTest.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Visual Studio 2017 Set Up Issues

Post by CuteAlien »

When you create new projects in VS you have several options like "Windows Console Application" and "Windows Desktop Application". Those have different entry points. Console Applications (Irrlicht examples use those usually as it's kind the the default option for c++ and works cross-platform) look like:

Code: Select all

 
int main() 
 
or sometimes like this:

Code: Select all

 
int main(int argc, char* argv[])
 
When you use Windows Desktop Application you need:

Code: Select all

 
int CALLBACK WinMain(
  _In_ HINSTANCE hInstance,
  _In_ HINSTANCE hPrevInstance,
  _In_ LPSTR     lpCmdLine,
  _In_ int       nCmdShow
);
 
or (just written different, but nearly the same):

Code: Select all

 
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
 
Note: When you use "Windows Console Application" you get an additional console Window. I'd recommend that for now as it will have additional information which you can see otherwise only when you start your applications from a console (like DOS console or MSys).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Hephaestus
Posts: 4
Joined: Sun Feb 11, 2018 11:48 pm
Location: Mount Olympus

Re: Visual Studio 2017 Set Up Issues

Post by Hephaestus »

On that note, what exactly does that do.
Could you link me a tutorial please? I have obviously never touched Windows Desktop Applications so I am fairly new.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Visual Studio 2017 Set Up Issues

Post by CuteAlien »

Google for "WinMain c++" - the first 2-3 results are pretty informative.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Hephaestus
Posts: 4
Joined: Sun Feb 11, 2018 11:48 pm
Location: Mount Olympus

Re: Visual Studio 2017 Set Up Issues

Post by Hephaestus »

Okay, thank you for your help!
Post Reply