alaingalvan / CrossWindow

💻📱 A cross platform system abstraction library written in C++ for managing windows and performing OS tasks.
https://alain.xyz/libraries/crosswindow
MIT License
632 stars 50 forks source link

How can I use the library with visual studio? #5

Closed TheEpicFace007 closed 3 years ago

TheEpicFace007 commented 4 years ago

I compiled the library and added the .lib and added the include directory to a build of the example however I got the following errors:


1>WindowsProject3.cpp
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(31,25): error C2065: 'Window': undeclared identifier
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(31,14): error C2923: 'std::shared_ptr': 'Window' is not a valid template type argument for parameter '_Ty'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(32,23): error C2065: 'Window': undeclared identifier
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(32,14): error C2923: 'std::weak_ptr': 'Window' is not a valid template type argument for parameter '_Ty'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(6,11): error C2039: 'WindowDesc': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(6,22): error C2065: 'WindowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(6,22): error C2146: syntax error: missing ';' before identifier 'windowDesc'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(6,22): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(7,5): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(8,5): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(9,5): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(10,5): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(11,5): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(16,11): error C2039: 'Window': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(16,18): error C2065: 'Window': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(16,18): error C2146: syntax error: missing ';' before identifier 'window'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(16,18): error C2065: 'window': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(17,11): error C2039: 'EventQueue': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(17,22): error C2065: 'EventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(17,22): error C2146: syntax error: missing ';' before identifier 'eventQueue'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(17,22): error C2065: 'eventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(19,10): error C2065: 'window': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(19,24): error C2065: 'windowDesc': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(19,36): error C2065: 'eventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(30,9): error C2065: 'eventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(33,17): error C2065: 'eventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(35,25): error C2039: 'Event': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(35,30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(35,30): error C2143: syntax error: missing ';' before '&'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(35,32): error C2065: 'event': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(35,40): error C2065: 'eventQueue': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(37,17): error C2065: 'event': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(37,37): error C3083: 'EventType': the symbol to the left of a '::' must be a type
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(37,48): error C2039: 'Mouse': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(37,53): error C2065: 'Mouse': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(39,29): error C2039: 'MouseData': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(39,39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(39,39): error C2146: syntax error: missing ';' before identifier 'mouse'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(39,39): error C2065: 'mouse': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(39,47): error C2065: 'event': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(41,17): error C2065: 'event': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(41,37): error C3083: 'EventType': the symbol to the left of a '::' must be a type
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(41,48): error C2039: 'Close': is not a member of 'xwin'
1>C:\Users\ASD\Project\cpp\libraries\CrossWindow-master\src\CrossWindow\Common\Window.h(29): message : see declaration of 'xwin'
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(41,53): error C2065: 'Close': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(43,17): error C2065: 'window': undeclared identifier
1>C:\Users\ASD\source\repos\WindowsProject3\WindowsProject3\WindowsProject3.cpp(47,13): error C2065: 'eventQueue': undeclared identifier
1>Done building project "WindowsProject3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========```
pheonixfirewingz commented 3 years ago

I do not believe you are linking the library and do you have the required headers in your project

alaingalvan commented 3 years ago

So this library is designed to be used with CMake, since CMake automates things like adding a platform specific main file, including only the .cpp and .h files you need, etc.

It's possible to use this library as a .lib file without CMake but it does make thing harder:

Using CrossWindow with as a .lib should be a matter of compiling the library, then including CrossWindow's header files found in the src/ folder. Just including that folder should be enough.