tipforeveryone Posted May 5, 2018 Share Posted May 5, 2018 Today I feel good to start learning new thing in Leadwerks, that is C++ with long time bought Professional DLC (I did this before but not successful) I remember that now Leadwerks 4.4 support VS2017 then I do some simple steps Create a Blank Project in Leadwerks Editor Open Projects/Windows/TestBlankProject.sln by VS2017 Goto Build > Build Solution F7 then I get this This is what I found https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-error-lnk2019?f1 But I don't understand anything on that page to find the solution (what a long content) I just want to start with a simple "Hello world" test for my new thing, but It seems not to be smooth as I expected.. Please help Quote Link to comment Share on other sites More sharing options...
gamecreator Posted May 5, 2018 Share Posted May 5, 2018 Not sure how to help with your error but try this and let me know if it works: Create a new project Open the SLN file Remove App.h and App.cpp from the Solution Explorer (under Source and Header Files folders) Replace the contents of main.cpp with this example: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { Leadwerks::Window* window = Leadwerks::Window::Create(); Context* context = Context::Create(window); while (true) { if (window->Closed() || window->KeyHit(Key::Escape)) break; context->SetColor(0.0, 0.0, 1.0); context->Clear(); //Draw some text centered on the screen std::string text = "Hello!"; Font* font = context->GetFont(); int x = context->GetWidth() / 2; int y = context->GetHeight() / 2; x -= font->GetTextWidth(text) / 2; y -= font->GetHeight() / 2; context->SetBlendMode(Blend::Alpha); context->SetColor(1.0, 1.0, 1.0); context->DrawText(text, x, y); context->SetBlendMode(Blend::Solid); context->Sync(); } return 0; } Right click on your project name in the Solution Explorer tab, click on Properties at the bottom. The Property Pages window should come up. Change the Configuration on the top left to All Configurations. Under Configuration Properties, General, you may have to change Windows SDK Version to 8.1 In the same window, under Debugging, Working Directory remove the two dots at the end so that it just says "$(SolutionDir)\..\..\" (I hope Josh fixes this eventually) Click OK. I then also switch to Release version near the top instead of Debug Does that run for you and print Hello! on a blue screen or do you get an error still? 1 1 Quote Link to comment Share on other sites More sharing options...
tipforeveryone Posted May 8, 2018 Author Share Posted May 8, 2018 It was built successfully but I get this instead I wonder is there another way less painful to use VS2017 with Leadwerks 4.5 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted May 8, 2018 Share Posted May 8, 2018 You're almost there! That's the error you get when Leadwerks can't find the shader because the path is incorrect. Did you change the folder under Debugging, Working Directory to $(SolutionDir)\..\..\ (I forgot to specify Working Directory earlier but it was in the Debugging section. I edited my other post to clarify.) The good news is that should be the last thing to set up the project and you only need to do it when you start a new project. It doesn't take long once you know what you need to do. 1 1 Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted May 9, 2018 Share Posted May 9, 2018 Still, this kind of stuff should work right out of the box right? The amount of time you lose and the frustration this brings. I can imagine this would drive people away from C++. 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted May 9, 2018 Share Posted May 9, 2018 1 hour ago, AggrorJorn said: Still, this kind of stuff should work right out of the box right? I would think so too. I'm not sure why it's a low priority. Seems like it would be just a few minutes of work to fix the template but I could be wrong here. Quote Link to comment Share on other sites More sharing options...
GorzenDev Posted May 9, 2018 Share Posted May 9, 2018 Honestly it does annoy me in a way aswell. But have no fear i got a solution for you guys. The question tipforeveryone had about templates actually made me think about a permanent solution for this. It involves editing the Common Template though, which can cause problems if/when the Template gets an official update. Sorry for the windows only answer i have no experience with Linux. Open folder "Leadwerks/Templates/Common/Projects/Windows". Open file "$PROJECT_NAME.vcxproj.user" with your favorite text editor (i like notepad++). Change all instances of "$(SolutionDir)\..\..\.." to "$(SolutionDir)\..\..\". Open file "$PROJECT_NAME.vcxproj" with your favorite text editor. Change all instances of "$(SolutionDir)..\..\" to "$(SolutionDir)\..\..\". !!_WARNING_!! Making these changes lets the editor think there has been an update so ALL your projects would need to be updated. 1 Quote Link to comment Share on other sites More sharing options...
tipforeveryone Posted May 11, 2018 Author Share Posted May 11, 2018 @GorzenDev Thank you so much, I works! Now I can continue to learn C++ with Leadwerks ! Yay ! Quote Link to comment Share on other sites More sharing options...
aiaf Posted May 11, 2018 Share Posted May 11, 2018 Because I didn't like codeblocks on linux, I created my own project setup using cmake. So i keep updating this with new leadwerks releases. I'm hopefull with leadwerks 5 i don't have to do this anymore with Visual Code becoming official editor. Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.