• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Juliean

Nullptr over-defined all the sudden (wtf?)

7 posts in this topic

Hello,

 

I've just been back from my summer home to my studend accomodation. Now, when trying to compile my engine here after cloning it from GIT, I've encountered one specific error:

1>c:\acclimate engine\repo\acclimate\dx11\render\..\..\Render\StateGroup.h(54): error C2664: 'acl::dx11::BindRenderTargets::BindRenderTargets(const acl::dx11::BindRenderTargets &)' : cannot convert parameter 4 from 'int' to 'const acl::dx11::d3d::DepthBuffer *' (DX11\Render\Stage.cpp)
1>          Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

in this line:

			const d3d::Texture* pTextures[] = {nullptr}; 
			m_stageStates.Add<BindRenderTargets>(pTextures, 1, nullptr);

Now, I'd probably searched some time, but I've noticed that the nullptr in this instance was painted violet instead of blue - so it was in the rest of the file, as well as the rest of the project! Now the issue appeared to me - nullptr was defined 0, which causes the template to deduce the wrong type for the last parameter (heh, thats why you should use them, I did it for convienince but seems to pay of).

 

Now, regardless of that the issue can "easily" be solved by adding an #undef nullptr to this file and all other files that possibly use it... how come this happening? At my laptop, I don't have that problem. I just compiled it not 1 hour ago, same commit. I'm using the same compiler, too - VS2012 with CTP - and I'm not using any external libaries other than the DirectX-sdk - 2010-version, on both PCs. I can hardly track where it comes from, too, since unless I undef, exluding specific files will take ages to make any difference for the markup. It also seem to affect almost the entire code, so I'm not sure.

 

Well, do you have any idea where this could come from?

0

Share this post


Link to post
Share on other sites

Unfortunately, "Go to definition" (as well as all other options near that, except for "go to header") are grayed out. It doesn't even show me the definition if I hover over it, so its really weird. I think the only logical solution would be that it was defined in the directx-sdk... any idea if dx does that/did that at some point?

 

EDIT: Appearently, at least when searching the SDK include dir for "nullptr" in notepad++, it doesn't show any hit. More ideas where this could come from? My version of VS here is german, the other one english, but both have the SP1 installed, I'm really out of ideas.

Edited by Juliean
0

Share this post


Link to post
Share on other sites

It says parameter 4 but it seems there aren't 4 parameters in the function call?

Perhaps the error is something completely different. Try rebuild all or checking out the code anew into a different directory and building that, perhaps there's something cached from an old version.

2

Share this post


Link to post
Share on other sites


It says parameter 4 but it seems there aren't 4 parameters in the function call?

Perhaps the error is something completely different. Try rebuild all or checking out the code anew into a different directory and building that, perhaps there's something cached from an old version.

 

Oups, in that matter, I should've posted the function definition:

template<typename S, typename... Args>
void StateGroup::Add(Args&& ... args) 
{
}

Variadic templates, and I don't know if its a bug of the CTP, but it starts couting "S" as 1, and the third parameter is then the fourth. And its definately due to this, like I said, if I add

#undef nullptr

at the top of the file, it works. Also if I specify a pointer to the expected object manually to nullptr and pass it in. Thats why nullptr is so cool for (variadic) templates, it auto-deduces the type, where NULL/0 will make out "Int" (unless its typedef'd to latter, lol). Then again, I've just been pulling hunders of commits from over 2-3 months into a local repo that I've been working on the last 3-4 months before, so it shouldn't hurt to give rebuilding & cleaning a try...

 

Nope, as I expected, didn't work eigther. Thanks still for the input, any more ideas however?

0

Share this post


Link to post
Share on other sites

There should be a compiler option which lets you output the text seen after preprocessing. Compile the broken .cpp file with that option and look at the preprocessor output to see where the macro is being introduced. It should be easy from the surrounding context to deduce the origin.

 

 

Also, make sure it isn't a project (or file) specific macro defined on the compiler command line (vs. an actual #define).

2

Share this post


Link to post
Share on other sites

I think the easiest way to narrow the problem is to get a list of dependancies for the .o file you attempt to generate (or do generate if you use a file without the compile error, but still have nullptr as a macro). Then seach those for some variant of "#define nullptr".

 

Unfortunately, Windows doesn't provide good tools to do that..There probably is a way to get msvc to output the dependancy list, but searching them isn't trivial. It's why I like to use Cygwin. Getting it just to solve this problem is overkill (though you might consider g, but you can get a standalone "grep" application for windows. Or you can try to use windows and msvs's dificient tools for looking through files.

0

Share this post


Link to post
Share on other sites

It says parameter 4 but it seems there aren't 4 parameters in the function call?

Perhaps the error is something completely different. Try rebuild all or checking out the code anew into a different directory and building that, perhaps there's something cached from an old version.

 

Looks like a member function, so the first parameter is "this" which pushes the others out one position, but it doesn't appear in the args list.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0