sleepy-discord
sleepy-discord copied to clipboard
Files and libraries are included, but project won't compile
Hi, I'm trying to use your library and I'm encountering an issue.
Nevertheless, when I peek the definition of the SleepyDiscord namespace, it takes me there:
I could never compile a project that linked sleepy_discord (not even the examples provided). I linked all the libraries and dependencies and followed your guide, but it doesn't seem to work for me.
I don't have any problem with the include directives. No errors there, but it says that SleepyDiscord namespace doesn't exist or something like that. Maybe it's a noob mistake (it's actually my first time linking libraries and so in c++, so I could've messed up somewhere).
Thanks in advance.
I'm going to guess this is an issue with your deps folder and that you are using websocketpp. In your deps folder, check that you have included websocketpp correctly. If it was incorrect, recompile Sleepy Discord and it should work. Also make sure that you include IncludeNonexistant last.
@yourWaifu i have the same issue too. What did i not do or did wrong? I launched setup.py and pressed Enter in every step. Then i created empty C++ project in VS2017. In "Include Directories" i included "E:\sleepy-discord\include", "E:\sleepy-discord\deps", "E:\sleepy-discord\deps\include" and "E:\sleepy-discord\include\sleepy_discord\IncludeNonexistent". In "Library Directories" i included "E:\sleepy-discord\deps\lib". In Linker->Input->Additional Dependencies i pasted "sleepy_discord.lib". My deps folder has only empty folders "lib" and "include". And now VS says me "name followed by '::' must be a class or namespace name"
I launched setup.py and pressed Enter in every step
Umm, I don't think that's what you were supposed to do. I'm going to guess you wanted to use Websocketpp on Windows. If so, delete your deps folder, and redo by giving these inputs to setup.py.
0
0 1
This shouldn't affect your error, but for the Library Directories, you are missing the directory where sleepy_discord.lib is compiled to, and for Additional Dependencies, unless you are not using any other librarys, you are missing the lib files for your other librarys needed for Sleepy Discord to work.
If you want to use Sleepy Discord without any other librarys, you already have the library compiled, so just link the library, and write your own code. None of the examples will work for you as a lot of it will depend on the code you will write to talk to my library. However, the Unofficial 3DS Client, and WebAssembly Client are good examples of how this can be done.
@yourWaifu Thank you for your answer.
Now i launched setup.py and inputed 0 and 0 1. Now i included \include, \deps, \deps\include and \include\sleepy_discord\IncludeNonexistent and library \deps\lib. Before building solution there are no errors, but after it there are some warnings and only one error:
C4996 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.10.25017\include\xutility 2350
I have already fixed this issue, someone else reported on it, and I was planning on doing a wave of commits with a fix for this issue. Plus just add _SCL_SECURE_NO_WARNINGS to your list of preprocessors like the error tells you will disable it.
One of two things, you can apply this simple change that should fix it (Note: this is untested as I'm working on other things)
or just disable the error
@yourWaifu for me first thing didn't do anything. Second thing replaced the error with these errors: https://pastebin.com/c2Z5E66j
for the first one, I'm guessing you forgot to recompile
for the second one, it looks it is not linking sleepy_discord.lib, which makes sense, because you didn't add the folder that the compiler compiled sleepy_discord.lib into your Library Directories.
Please read this line from https://yourwaifu.github.io/sleepy-discord/link.html as you missing some important info that is stated in the docs, it's ok if you missed them, since this isn't the first time this happened to someone.
Step 6: Do the same thing for Library Directories, add the folder with Sleepy_Discord and all it’s needed libraries. This tells Visual C++ to search for library files in these folders
However, then again it should have work if it doesn't say that it couldn't find sleepy_discord.lib, in that case you may have been missing other librarys too or you should recompile.
@yourWaifu the problem is that i'm getting errors while compilating sleepy_discord.lib ._.
Severity Code Description Project File Line Suppression State
Error MSB3073 The command "cd ..\..\..\..\GitHub\emsdk
emsdk_env --build=Release
cd ..\..\nsprojects\sleepy_discord\buildtools
emmake make -f Makefile.linux CXX="emcc -O2 -s WASM=1" CXXFLAGS="-std=c++11 -DSLEEPY_USE_HARD_CODED_GATEWAY" AR="emcc -O2 -o" SUFFIX=.o
xcopy libsleepy_discord.o ..\examples\wasm_example /y
cd ..\examples\wasm_example
emcc -O2 -std=c++11 -I ../../include -I ../../include/sleepy_discord/IncludeNonexistent libsleepy_discord.o wasm_websocket.cpp main.cpp --pre-js mod.js --js-library websocket.js --js-library session.js -s WASM=1 --emrun -o discord.html" exited with code 9009. wasm_example C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44
Warning C4996 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' sleepy_discord C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\include\xutility 2350
Warning LNK4221 This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library sleepy_discord E:\sleepy-discord\sleepy_discord\experimental.obj 1
Warning LNK4221 This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library sleepy_discord E:\sleepy-discord\sleepy_discord\discord_object_interface.obj 1
Error LNK1104 cannot open file 'libcurl_a.lib' hello E:\sleepy-discord\examples\hello\LINK 1
Error LNK1104 cannot open file 'libcurl_a.lib' rock-paper-scissors E:\sleepy-discord\examples\rock-paper-scissors\LINK 1
umm that doesn't make sense, how are you getting those? that's for compiling the Web Assembly client not Sleepy Discord
@yourWaifu so how can i get sleepy_discord.lib?
by compiling it from here.
or this https://yourwaifu.github.io/sleepy-discord/compile.html#compiling-sleepy-discord
@yourWaifu ok, now i compiled successfully and included the library. New error list is there: https://pastebin.com/EpCM4hei
take a look at step 7 to 8 https://yourwaifu.github.io/sleepy-discord/link.html. The example should be what you are looking for tho.
@yourWaifu i'm not sure what libraries i should add there. I added libcryptoMT.lib and libsslMT.lib from deps\lib folder and now there are these errors: https://pastebin.com/2YDmRvgb I suppose i didn't add some libraries.
You forgot to add libcurl, take a look at preparing https://yourwaifu.github.io/sleepy-discord/link.html#how-to-link for some of the others, you will need to link crypt32.lib, it's a windows library for their CryptoAPI.
if you follow the directions for compiling libcurl, it should be in sleepy_discord\deps\cpr\opt\curl\builds
, move it to your deps/lib
and deps/include
folders. I have no idea where crypt32.lib is, but visual studio should know where to look for that.
@yourWaifu i haven't got builds folder
did you compile libcurl?
@yourWaifu Thank you very much! Now i compiled example without any errors. I don't know if i realy need crypt32.lib, at least there are no errors yet.
No problem, I'm not sure if this is because of libcurl, however you will need it if you getting linker errors from libcrypto.
@yourWaifu off topic, but how can i send utf-8 messages? If i'm using utf-8 symbols like ñ or д i'm getting this
I think it's done with Unicode Escape sequence or whatever they are called. For example \\u0394
@yourWaifu converting cp1251 to utf8 helped me