Error 1 error C1083: Cannot open include file: 'cocostudio/ObjectFactory.h': No such file or directory ..\cocos\ui\guidefine.h
Error 2 IntelliSense: cannot open source file "cocostudio/ObjectFactory.h" ..\cocos\ui\GUIDefine.h
you need to add cocostudio directory into your project so that it can search its header file. Its in ROOT\cocos\editor-support\ then you can see cocostudio there. Once it is done, you might have LINKER error, you need to link to cocostudio library as well.
I have added (as highlighted in yellow) what I think is the includes for cocos ui and cocos studio and even added both ui and studio projects as libraries.
I still get the errors above, and all my efforts result in the same errors.
I got it to work using as reference the sample tests setup.
Then, I added references to libCocosStudio (don’t know if it still necessary) and libGUI. It worked perfectly.
Also, UILayer is not necessary anymore. I just added directly in my Scene my UI components.
Hope it helps. I searched a lot about this issue.
I meet the same issue as @utilae reported.
I have added the libGUI and libCocosStudio project in Visual Studio. The game project also include the project reference and dependency/build order has been setup.
Sadly… by solving it late at night and later deleting the folder with the test working I’m trying to reproduce my sucess again WITH NOTES.
If I get it working, I’ll post again
2. Add New Reference in HelloCppComponent project (see image)
3. Include
#include "ui/CocosGUI.h"
4. Using IMPORTANT: always after USING_NS_CC
USING_NS_CC // must come befor using namespace ui
using namespace ui;
5. Test code:
// TEST WITH NEW LABEL
auto size = Director::getInstance()->getWinSize();
I’m getting the same error… what do you mean by “add cocostudio directory into your project”? In Visual Express 2013, I’ve tried adding that directory into the Include paths (Project/Properties), and still doesn’t work. The library “libCocosStudio” is also referenced (but that’s not related to the compiler won’t finding the headers, of course)
A library file (.lib) can be created by dragging a project/solution file eg libGUI.vcxproj
into the Solution Explorer to add it to the project. It will become eg libGUI
Solution Explorer -> Right Click Project -> Build Dependencies
to make sure the newly added project is ticked so it is built.
Build the project and the .lib file will be created in the project debug directory.
The .lib references must be added into the Linker Additional Dependencies eg libGUI.lib;
The project that was added in eg libGUI, can be removed.
if (eEventType != ui::Widget::TouchEventType::ENDED) return;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MessageBox(“You pressed the close button. Windows Store Apps do not implement a close button.”, “Alert”);
return; #endif
Thanks a lot for your response, @utilae. Unfortunately, even after following your notes, I still get the same output: error C1083: Cannot open include file: ‘cocostudio/ObjectFactory.h’: No such file or directory
This is clearly a compile error, not a linking one… but I’m unable to tell Visual Studio where to look for the include headers, it seems…
I’ll try upgrading the project to v3.2 rc0, and update here…
Thanks, I had already checked that, I had CocosGUI.h included. The only way to make it work, was to copy the cocostudio folder into my project. Still, I got other issues later… and never got the VideoPlayer component to work.
I’m feeling that the v3.X branch is still very unstable, so I’ve decided to downgrade my project to cocos2d-x v2.2.5. I love the new API, but I prefer to work with more solid ground