[SOLVED] New Project in VS2017 Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
eriejar
Gnoblar
Posts: 4
Joined: Thu Feb 28, 2019 6:22 am

[SOLVED] New Project in VS2017

Post by eriejar »

Ogre Version: 1.11.5
Operating System: Windows 10
Render System: :?:

Hi everyone,
I got the source code to build and compile for Ogre3D and also set the environmental variable to the SDK folder.
However I have no clue now how to make a new Ogre3D project in VS2017. I have never made CMake files also so I would need a good guide for it. Or is there a CMake that you copy and paste?

I tried following two different guides but failed at proceeding in different areas due to different reasons.
https://ogrecave.github.io/ogre/api/latest/setup.html
I replaced the OGRE_CONFIG_DIR with the environmental variable to the SDK however I have no clue where CMAKE_BINARY_DIR points to as that isn't a environmental variable for me.

http://wiki.ogre3d.org/Setting+Up+An+Ap ... ual+Studio
This one failed due to adding various libraries that ended up not existing.
Specifically
OgreMain_d.lib
OIS_d.lib
seemed to fail the compile.

Any help would be greatly appreciated.
Last edited by eriejar on Mon Mar 04, 2019 9:03 am, edited 1 time in total.
Owl53
Halfling
Posts: 92
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: New Project in VS2017

Post by Owl53 »

Hi,

I similarly struggled to find an up-to-date example of how to build a VS project using Ogre. Afterwards, I found the thread below on the forums, and using the example CMakeLists in it successfully managed to build the project and got it working.

viewtopic.php?f=2&t=94823

Hope this helps :)
eriejar
Gnoblar
Posts: 4
Joined: Thu Feb 28, 2019 6:22 am

Re: New Project in VS2017

Post by eriejar »

Hi,

Thanks for the link! It helped me get to the point where I can compile the program when it uses libraries and headers; specifically, I copied the source code for the OgreBites sample. However, while it did compile, it now closes the application after telling the user

Code: Select all

The code execution cannot proceed because OgreMain_d.dll was not found. Reinstalling the program may fix this problem.
As long with the same message but with
1) OgreRTShaderSystem_d.dll
2) OgreBites_d.dll
I checked and the files are inside the bin of the SDK, so it isn't copying them over with the given CMakeLists; given the manual originally had a two liner. I assume that the resources.cfg was supposed to handle that but maybe there needs to be an extra step?

Thanks once again.
rpgplayerrobin
Gnoll
Posts: 619
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: New Project in VS2017

Post by rpgplayerrobin »

The DLL files needs to be in the same directory as your compiled EXE file.
When I compile Ogre source I manually take those DLL files and place them in my own project. Luckily, it is pretty rare that you have to change something in the Ogre source.
Owl53
Halfling
Posts: 92
Joined: Sat Jul 22, 2017 2:32 pm
x 4

Re: New Project in VS2017

Post by Owl53 »

rpgplayerrobin wrote: Thu Feb 28, 2019 5:51 pm The DLL files needs to be in the same directory as your compiled EXE file.
When I compile Ogre source I manually take those DLL files and place them in my own project. Luckily, it is pretty rare that you have to change something in the Ogre source.
This. I copy the DLLs into the folder with the EXE as well. That should solve the error :)
eriejar
Gnoblar
Posts: 4
Joined: Thu Feb 28, 2019 6:22 am

Re: New Project in VS2017

Post by eriejar »

Ah gotcha, I guess you wouldn't "automate" that with CMake then. Thought of copying it too but that seemed a bit too manual.
Anyways, after doing that and attempting to compile and run the program it works!
However it does seem to crash upon attempting to unzip a file in the setup() method of the OgreBites, that does seem to be a completely seperate issue so I probably should put that in another thread, though any help would be great.

Error Message:

Code: Select all

"../Media/packs/SdkTrays.zip - error whilst opening archive: Unable to read zip file."
rpgplayerrobin
Gnoll
Posts: 619
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: New Project in VS2017

Post by rpgplayerrobin »

I guess you have the source, when does the error come? Can't you just step through each line until that error comes up? That should tell you exactly why it is happening. Probably because it cannot find the file I would guess.
eriejar
Gnoblar
Posts: 4
Joined: Thu Feb 28, 2019 6:22 am

Re: New Project in VS2017

Post by eriejar »

Updates on what fixed it:

The cfg file had to have the paths changed to absolute ones. After that everything went smoothly. (Paths to the media folder)
Catchmar
Gnoblar
Posts: 5
Joined: Thu Mar 07, 2019 5:35 pm

Re: [SOLVED] New Project in VS2017

Post by Catchmar »

I set the project up, copied the DLLs with the cfgs into C:\OgreProjects\Debug (where the exe file is) and updated the paths in the cfgs (i.e. FileSystem=../Media is now FileSystem=C:/OgreProjects/Media).
The project build successfully, but I get the "Error occurred during execution: bad allocation" message on the start (see below).

Image

The code of my entry file (ogreproj.cpp):

Code: Select all

#include "Ogre.h"
#include "OgreApplicationContext.h"
#include "OgreInput.h"
#include "OgreRTShaderSystem.h"
#include "OgreApplicationContext.h"
#include <iostream>

using namespace Ogre;
using namespace OgreBites;

class BasicTutorial1
	: public ApplicationContext
{

public:
	BasicTutorial1() : ApplicationContext("OgreTutorialApp")
	{}
	virtual ~BasicTutorial1() {}

	void setup()
	{
		ApplicationContext::setup();
	}

};

int main(int argc, char **argv)
{
	try
	{
		BasicTutorial1 app;
		app.initApp();
		//app.getRoot()->startRendering();
		app.closeApp();
	}
	catch(const std::exception& e)
	{
		std::cerr << "Error occurred during execution: " << e.what() << '\n';
		return 1;
	}

	return 0;
}
Does anybody know how to fix this?
Post Reply