SDL_main unresolved and RenderSystem not found Topic is solved

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
King Chrome
Gnoblar
Posts: 5
Joined: Sun May 23, 2021 8:06 pm

SDL_main unresolved and RenderSystem not found

Post by King Chrome »

I am trying to build the empty project in visual studio and I wind up with the follow errors:
  • Error LNK1120 one unresolved externals >> EmptyProject >> C:\User\Desktop\EmptyProject\bin\Debug\EmptyProject.exe
  • LNK2019 unresolved external symbol SDL_main referenced in function main_getcmdline >> EmptyProject >> C:\User\Desktop\EmptyProject\out\build\SDL2main.lib(SDL_windows_main.obj)
  • Error LNK2005 WinMain already defined in EmptyProject.obj >> EmptyProject >> C:\User\Desktop\EmptyProject\out\build\SDL2main.lib(SDL_windows_main.obj)
I have already linked SDL2.lib, SDL2_main.lib as well as there directory \SDL2-2.0.20\lib\x64.

What else could be the problem?
Last edited by King Chrome on Sat Jan 22, 2022 6:13 am, edited 1 time in total.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: SDL_main unresolved

Post by dark_sylinc »

Ummm... I have no idea what those errors mean without additional info.

It would appear as if you're accidentally trying to build SDL2 from scratch... somehow

How is the directory structure of EmptyProject? What steps are you doing?

Cheers
King Chrome
Gnoblar
Posts: 5
Joined: Sun May 23, 2021 8:06 pm

Re: SDL_main unresolved

Post by King Chrome »

SDL wasn't found when CMAKE configured the project. So I backtracked and was able to fix it.

But I have a new problem:
Image

So I thought I would add a plugin_d.cfg to the build directory but then I get:

Image

I am following these instructions which says to copy ogre into to a new project.

The new project is on \..\Desktop
I copied everything from my \dev\ogre-next folder (that I used to see samples) to \Desktop\EmptyProject\Dependencies\Ogre
This is what the EmptyProject directory looks like:
Directory
Subdirectories
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: SDL_main unresolved and RenderSystem not found

Post by dark_sylinc »

Cool! You're very close!

The problem you encountered happens because of two reasons:

EmptyProject's CMake script should've generated a plugins_d.cfg like this:

Code: Select all

# Defines plugins to load

# Define plugin folder
PluginFolder=Plugins

# Define plugins

Plugin=RenderSystem_GL3Plus_d
Plugin=RenderSystem_Vulkan_d
Notice that it says PluginFolder=Plugins otherwise it will be looking in the wrong place.

The 2nd possible issue is that the working directory is wrong. This shouldn't be a problem if you double click the exe, but it may be a problem if you launch from Visual Studio.
Make sure the working directory (Alt+F7 to open that) is in the right folder (i.e. in bin\Debug):

Image
King Chrome
Gnoblar
Posts: 5
Joined: Sun May 23, 2021 8:06 pm

Re: SDL_main unresolved and RenderSystem not found

Post by King Chrome »

The right config file made everything work!

One last thing. Where do I go from here?

If it is this tutorial. https://ogrecave.github.io/ogre/api/lat ... scene.html

Then in what file do I add the code for the scene manager?
I couldn't find TutorialApplication::setup or an equivalent

Image
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: SDL_main unresolved and RenderSystem not found

Post by dark_sylinc »

Hi!

That tutorial is for Ogre 1.x, not Ogre-Next (notice our site is at https://ogrecave.github.io/ogre-next/api/latest).
But there's a lot of similarities and some concept still apply. Entity still exists (but it's now under v1::Entity) and "Item" replaces v1::Entity.

As for your quesiton, the SceneManager is already set up for you in GraphicsSystem::chooseSceneManager (GraphicsSystem.cpp) and the places we left for you to place your own code is in EmptyProjectGameState::createScene01 and EmptyProjectGameState::update (this one gets called every frame).
(Btw you are not forced to follow this template it's just for convenience and show how to setup everything properly following best practices)
Post Reply