#includes error
368 messages · Page 1 of 1 (latest)
When your question is answered use !solved or the button below to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
What build system, cmake?
Dunno im new to cpp
But im trying to use protobufs
What i do normally is just use compile_commands.json
Been stuck for hours 
this is the current full code
#include <iomanip> // for std::setw, std::setfill
#include <vector>
#include <cstdint>
#include <winsock2.h>
#include <ws2tcpip.h>
#include "agar_v26.pb.h"
#include <iostream>
#pragma comment(lib, "ws2_32.lib")
const int ListenPORT = 9000;
void ReadExactly(SOCKET ClientSocket, std::vector<char>& buffer, int size) {
int bytesRead = 0;
while (bytesRead < size) {
int result = recv(ClientSocket, buffer.data() + bytesRead, size - bytesRead, 0);
if (result == SOCKET_ERROR) {
std::cerr << "recv failed: " << WSAGetLastError() << std::endl;
closesocket(ClientSocket);
WSACleanup();
exit(1);
}
if (result == 0) {
std::cerr << "Connection closed by peer" << std::endl;
closesocket(ClientSocket);
WSACleanup();
exit(1);
}
bytesRead += result;
}
}
void handleClient(SOCKET ClientSocket) {
std::vector<char> lenBuf(4);
std::vector<char> buffer;
while (true){
ReadExactly(ClientSocket, lenBuf, 4);
uint32_t netLength;
memcpy(&netLength, lenBuf.data(), 4);
uint32_t length = ntohl(netLength);
buffer.resize(length);
ReadExactly(ClientSocket, buffer, length);
std::cout << "Received message (" << buffer.size() << " bytes): ";
for (unsigned char c : buffer) {
std::cout << std::hex << std::uppercase
<< std::setw(2) << std::setfill('0')
<< static_cast<int>(c) << " ";
}
std::cout << std::dec << std::endl; // reset to decimal
buffer.clear();
}
}
int main() {
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
std::cerr << "WSAStartup failed: " << iResult << std::endl;
return 1;
}
std::cout << "WSAStartup successful" << std::endl;
SOCKET ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ListenSocket == INVALID_SOCKET) {
std::cerr << "socket failed: " << WSAGetLastError() << std::endl;
WSACleanup();
return 1;
}
std::cout << "Listening Socket Created Successfully" << std::endl;
sockaddr_in ListenAddr;
ListenAddr.sin_family = AF_INET;
ListenAddr.sin_port = htons(ListenPORT);
ListenAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(ListenSocket, (sockaddr*)&ListenAddr, sizeof(ListenAddr)) == SOCKET_ERROR) {
std::cerr << "Bind failed\n";
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Bind Successful" << std::endl;
if (listen(ListenSocket, SOMAXCONN) == SOCKET_ERROR) {
std::cerr << "Listen failed\n";
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Listening on port " << ListenPORT << std::endl;
while (true) {
SOCKET ClientSocket = accept(ListenSocket, NULL, NULL);
if (ClientSocket == INVALID_SOCKET) {
std::cerr << "Accept failed: " << WSAGetLastError() << std::endl;
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Connection accepted" << std::endl;
handleClient(ClientSocket);
}
return 0;
}
i got clang++ and g++ tho
should i give compile commands content ?
yeah
[
{
"directory": "C:/Users/spn/Desktop/C&C++",
"command": "clang++ ps.cpp agar_v26.pb.cc -o ps.exe --target=x86_64-w64-windows-gnu --sysroot=C:/msys64/mingw64 -std=c++20 -I. -IC:/protoc-28.0-rc-2-win64/include -LC:/protoc-28.0-rc-2-win64/lib -lprotobuf -static",
"file": "ps.cpp"
}
]
i tried even using gpt
still didnt work
So where do you have this file?
same directory
well one thing i noticed
dont have
-IC:/protoc-28.0-rc-2-win64/include -LC:/protoc-28.0-rc-2-win64/lib
.cc .h files
hold up i think im cooking
Wait, does this program compile for you at all? When you compile it in the terminal
And if so, what compiler command do you use?
PS C:\Users\spn\Desktop\C&C++> clang++ ps.cpp -o ps -lws2_32 ;./ps
In file included from ps.cpp:6:
./agar_v26.pb.h:14:10: fatal error: 'google/protobuf/runtime_version.h' file not found
14 | #include "google/protobuf/runtime_version.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
WSAStartup successful
Listening Socket Created Successfully
Bind Successful
Listening on port 9000
@karmic viper
imma try install cmake and run it over cmake list in the folder i have
Make it compile in the terminal first, and then start fixing the red squiggles
i fixed it by just running cmake and doing extra stuff ..... but at what cost
somehow my paths got wiped 💀💀💀💀
Paths?
Yeah this doens't look good
mr dippy @karmic viper
well basically idk if u all ever used protobuf
but in cpp what seems to u gotta compiler the whole project which will give you something called protoc and includes files
thats what i concluded
i have not
and then link the includes to ur project
google worship it

same for games
well for now i tried compiling the protobuf with cmake
they said i should do it in readme
i get this
which seems to be just absl libraray missing
I've managed to link to protobuf without any issue.
windows ?
without zlib, without absl provider
says.... it all
some private server for a game
they use protobuf
i need protobuf to be able to marshal and unmarshal msgs
yeah it doesn do anything for me. I mean what are you doing in your project regarding protobuf.
some random errors popup 🤣
tcp connection
tcp server
well
i didnt even bulid 5% of full thing yet lol
btw im beginner, i used to use go and python but i got nice knowledge of low level
this the current code if u want to see
How to install the protocol buffer compiler.
#include <iomanip>
#include <vector>
#include <cstdint>
#include <winsock2.h>
#include <ws2tcpip.h>
#include "agar_v26.pb.h"
#include <iostream>
#pragma comment(lib, "ws2_32.lib")
const int ListenPORT = 9000;
void ReadExactly(SOCKET ClientSocket, std::vector<char>& buffer, int size) {
int bytesRead = 0;
while (bytesRead < size) {
int result = recv(ClientSocket, buffer.data() + bytesRead, size - bytesRead, 0);
if (result == SOCKET_ERROR) {
std::cerr << "recv failed: " << WSAGetLastError() << std::endl;
closesocket(ClientSocket);
WSACleanup();
exit(1);
}
if (result == 0) {
std::cerr << "Connection closed by peer" << std::endl;
closesocket(ClientSocket);
WSACleanup();
exit(1);
}
bytesRead += result;
}
}
void handleClient(SOCKET ClientSocket) {
std::vector<char> lenBuf(4);
std::vector<char> buffer;
while (true){
ReadExactly(ClientSocket, lenBuf, 4);
uint32_t netLength;
memcpy(&netLength, lenBuf.data(), 4);
uint32_t length = ntohl(netLength);
buffer.resize(length);
ReadExactly(ClientSocket, buffer, length);
std::cout << "Received message (" << buffer.size() << " bytes): ";
for (unsigned char c : buffer) {
std::cout << std::hex << std::uppercase
<< std::setw(2) << std::setfill('0')
<< static_cast<int>(c) << " ";
}
std::cout << std::dec << std::endl; // reset to decimal
agario::proto::envelope envelope;
envelope.ParseFromArray(buffer.data(), buffer.size());
std::cout << envelope.DebugString();
buffer.clear();
}
}
int main() {
WSADATA wsaData;
int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
if (iResult != 0) {
std::cerr << "WSAStartup failed: " << iResult << std::endl;
return 1;
}
std::cout << "WSAStartup successful" << std::endl;
SOCKET ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (ListenSocket == INVALID_SOCKET) {
std::cerr << "socket failed: " << WSAGetLastError() << std::endl;
WSACleanup();
return 1;
}
std::cout << "Listening Socket Created Successfully" << std::endl;
sockaddr_in ListenAddr;
ListenAddr.sin_family = AF_INET;
ListenAddr.sin_port = htons(ListenPORT);
ListenAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(ListenSocket, (sockaddr*)&ListenAddr, sizeof(ListenAddr)) == SOCKET_ERROR) {
std::cerr << "Bind failed\n";
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Bind Successful" << std::endl;
if (listen(ListenSocket, SOMAXCONN) == SOCKET_ERROR) {
std::cerr << "Listen failed\n";
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Listening on port " << ListenPORT << std::endl;
while (true) {
SOCKET ClientSocket = accept(ListenSocket, NULL, NULL);
if (ClientSocket == INVALID_SOCKET) {
std::cerr << "Accept failed: " << WSAGetLastError() << std::endl;
closesocket(ListenSocket);
WSACleanup();
return 1;
}
std::cout << "Connection accepted" << std::endl;
handleClient(ClientSocket);
}
return 0;
}
i did check it
actually nvm
i didnt try check if i will get includes error aswell
CPMAddPackage("gh:protocolbuffers/[email protected]")
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)
it took 2 lines for me to link 🤔
ill see if i can include the file ur missing
took a bit more with FetchContent
include(FetchContent)
FetchContent_Declare(
protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v33.0
# Faster fetch; comment these two lines if you need full history/submodules
GIT_SHALLOW TRUE
SOURCE_SUBDIR cmake
)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(protobuf_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER OFF CACHE STRING "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(PROTOBUF_ABSL_PROVIDER STREQUAL "package")
find_package(absl QUIET)
endif()
FetchContent_MakeAvailable(protobuf)
set(Protobuf_FOUND TRUE)
You can install the protocol compiler, protoc, with a package manager under Linux, macOS, or Windows using the following commands.
this will just get compiler i assume
hmm could be
i mean u can just download the compiler by itself
but they say cpp must build it
so u get the includes aswell
so what should i do 
someone told me , just use rust/zig
🤣
include(cmake/CPM.cmake)
find_package(Catch2 3)
set(protobuf_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(protobuf_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER OFF CACHE STRING "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
CPMAddPackage("gh:protocolbuffers/[email protected]")
target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf)
use CPM

works for me
its a wrapper around cmake fetchcontent
basically a way to do one liner build from source stuff
dang
its not a good option for big team projects but for "just make it work" solutions, its good
basically i tell it to download and build the source from github
You said you fixed it, of course I dipped 
So did Laci's suggestion work?
i didnt
i will try now after i try something i tried asking gpt about
yeah seems like only was fixed at editor
Ah I see
i dont use gpt, vibecoding sucks
just when im hopeless
ah.... how to use and install cpm
download CPM.cmake from github
and include it in cmake
cmake folder of protobuf ?
no
just make a cmake directory in your project
and put CPM.cmake there
and include(cmake/CPM.cmake)
its just a cmake script that does stuff for you
include it in cmake...
not in your cpp source files
wait are you not using cmake 
im not, idk im always editing the json file
use cmake 👍
found someone doing this on google
clion mybeloved
never heard of it
i use it for all c++ stuff
its from jetbrains
its free
👍
heavyweight, but good
bro im gonna cry
still trying fix the problem like see this
g++ ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -IC:/Users/spn/Desktop/install/include -IC:/Users/spn/Desktop/absl-install/include -LC:/Users/spn/Desktop/install/lib -LC:/Users/spn/Desktop/absl-install/lib -lprotobuf -labsl_synchronization -labsl_base -labsl_raw_logging_internal -labsl_malloc_internal -labsl_spinlock_wait -lws2_32 -lstdc++ -static
This command is from the cmake log, right?
I recommend dropping all those custom -I and -L flags and installing those libraries in MSYS2
no
my eyes shutting
working since 4 am
12 hours straight
no avail
at this poin
t
im gonna try pay someone to do it no jokes
actually
should i just try link it on unix based system
From where then?
terminal
But like, weren't you using cmake before?
gonna give up on windows... was going to give up on cpp just bcuz of that
Or was that only for protobuf?
only for compiling protobuf
You don't need to give up on anything, just install all those libraries in MSYS2. This is the exact same thing you would do on linux
i did
Type pacman -Qe in MSYS2 and send the output
And also type gcm g++ in whatever terminal you're compiling from (not msys2 I assume?)
Do you want to use g++ or clang++ ? I saw you use clang before, but now you're using gcc
i got both lol
should i get rid of one of them
i assume clang
No, keeping both is fine
hmmm
Does your program need abseil?
yeah
pacman -S mingw-w64-x86_64-abseil-cpp
I'm not sure if you did it right, and it's faster to install in msys2 than to check 
Now just g++ ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -lprotobuf -labsl_synchronization -labsl_base -labsl_raw_logging_internal -labsl_malloc_internal -labsl_spinlock_wait -lws2_32
This is your command, but I removed all -I, -L, and -static too for now
If this doesn't work, send the first ~10 errors
So?
in msys terminal ?
labsl_malloc_internal -labsl_spinlock_wait -lws2_32
In file included from ps.cpp:6:
agar_v26.pb.h:16:2: error: #error "Protobuf C++ gencode is built with an incompatible version of"
16 | #error "Protobuf C++ gencode is built with an incompatible version of"
| ^~~~~
agar_v26.pb.h:17:2: error: #error "Protobuf C++ headers/runtime. See"
17 | #error "Protobuf C++ headers/runtime. See"
| ^~~~~
agar_v26.pb.h:18:2: error: #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
18 | #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
| ^~~~~
lemme try edit so it uses the protobuf i compiled in desktop
g++ ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -lC:\Users\spn\Desktop\install\include -labsl_synchronization -labsl_base -labsl_raw_logging_internal -labsl_malloc_internal -labsl_spinlock_wait -lws2_32
still cooked
but its Protobuf C++ gencode is built with an incompatible version of
btw im not running in msys
Doesn't matter, because gcm g++ showed you're running the same msys2 GCC even outside of the msys2 terminal
Ok, so regenerate the headers using the protobuf you installed in msys2
..
Yeah
Where to find the protobuf installed in msys if u mind me asking
Uhh, you mean protoc?
I never used it, is this you generate the headers?
You should be able to directly run it from your terminal. It's at C:\msys64\bin\protoc.exe, but this is the same location where you have g++.exe, and since you can run that directly, you should be able to run protoc directly too
Well
From where tf its pulling the includes of protobuf when i do -lprotobuf
nuh uh
Ah sorry, C:\msys64\mingw64\bin\protoc.exe
It searches C:\msys64\mingw64\include by default
You can confirm this by adding -H, it'll dump all headers it includes
yep exists
Good. But does just protoc alone not work?
protoc compiles .proto to .cc, .h files
but they need the includes
Ok, but what does this have to do with my question
@karmic viper i got rid of this version error
Good
means
no
but im back at the many errors
Can you run gcm protoc? I'm curious
You mean after you fixed the version error?
Can you show the first ~10 errors again?
ye
sure
Ok, let's try pacman -S mingw-w64-x86_64-lld, and then build with clang++ -fuse-ld=lld instead of g++

alr
Then both protoc and C:\msys64\mingw64\bin\protoc.exe should do the same thing. But I guess this doesn't really matter
Same command as you used before, but replace g++ with clang++ -fuse-ld=lld
alright
Clang with LLD isn't sensitive to the order of the -l flags, unlike GCC. If this works, this'll mean that the order is wrong
Okay, let's get rid of -lprotobuf -labsl_synchronization -labsl_base -labsl_raw_logging_internal -labsl_malloc_internal -labsl_spinlock_wait -lws2_32 and get all the flags from pkg-config
Install pacman -S mingw-w64-x86_64-pkgconf
i feel we are cooking
i was trying randomly for 3 days lmao
spn@DESKTOP-VEKLTVB MINGW64 ~
$ pkg-config --libs --cflags absl_log
-DNOMINMAX -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_lo
g_internal_format -labsl_str_format_internal -labsl_log_internal_nullguard -labsl_log_internal_struc
tured_proto -labsl_log_internal_proto -labsl_log_internal_log_sink_set -labsl_log_internal_globals -
labsl_log_globals -labsl_hash -labsl_city -labsl_low_level_hash -labsl_log_sink -labsl_strerror -lab
sl_vlog_config_internal -labsl_log_internal_fnmatch -labsl_synchronization -labsl_graphcycles_intern
al -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -ldbghelp -labsl_debugging_inte
rnal -labsl_demangle_internal -labsl_demangle_rust -labsl_decode_rust_punycode -labsl_utf8_for_code_
point -labsl_malloc_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_tracing_internal
-labsl_strings -labsl_strings_internal -labsl_string_view -labsl_int128 -labsl_base -ladvapi32 -labs
l_spinlock_wait -labsl_throw_delegate -labsl_raw_logging_internal -labsl_log_severity
spn@DESKTOP-VEKLTVB MINGW64 ~
should this command work outside msys
maybe i should try compile inside msys ?
Everything that you install via pacman -S mingw-w64-x86_64-... gets installed to C:\msys64\mingw64. And since you apparently have C:\msys64\mingw64\bin in the PATH, no surprise that it works
It shouldn't change anything
Ok, so try those
ye ik but sometimes random things happens
When they do, it's usually a skill issue 😛
copy all and put it in the command ?
Yes
lmao
In general, you should try to get all your library-specific flags from pkg-config instead of trying to guess them yourself
clang++ -fuse-ld=lld ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -lprotobuf -lws2_32
lemme add rn
clang++ -fuse-ld=lld ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -lprotobuf -lws2_32 -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_lo g_internal_format -labsl_str_format_internal -labsl_log_internal_nullguard -labsl_log_internal_struc tured_proto -labsl_log_internal_proto -labsl_log_internal_log_sink_set -labsl_log_internal_globals - labsl_log_globals -labsl_hash -labsl_city -labsl_low_level_hash -labsl_log_sink -labsl_strerror -lab sl_vlog_config_internal -labsl_log_internal_fnmatch -labsl_synchronization -labsl_graphcycles_intern al -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -ldbghelp -labsl_debugging_inte rnal -labsl_demangle_internal -labsl_demangle_rust -labsl_decode_rust_punycode -labsl_utf8_for_code_ point -labsl_malloc_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_tracing_internal -labsl_strings -labsl_strings_internal -labsl_string_view -labsl_int128 -labsl_base -ladvapi32 -labs l_spinlock_wait -labsl_throw_delegate -labsl_raw_logging_internal -labsl_log_severity
Ok, apparently protobuf works with pkg-config file too. So you can drop -lprotobuf and do pkg-config --libs --cflags absl_log protobuf
So does this work?
include all of em
pkg-config --libs --cflags absl_log protobuf absl_check
This maybe?
FYI instead of copypasting the flags you can do clang++ -fuse-ld=lld ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 $(pkg-config --libs --cflags absl_log protobuf absl_check)
using this
oo
only 2 errors
PS C:\Users\spn\Desktop\C&C++> clang++ -fuse-ld=lld ps.cpp agar_v26.pb.cc -o ps.exe -std=c++20 -lws2_32 -lprotobuf -labsl_log_internal_check_op -labsl_di
e_if_null -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_log_internal_format -labsl_log_internal_nullguard -labsl
_log_internal_structured_proto -labsl_log_internal_proto -labsl_log_internal_log_sink_set -labsl_log_sink -labsl_flags_internal -labsl_flags_marshalling
l_flags_program_name -labsl_log_initialize -labsl_log_internal_globals -labsl_log_globals -labsl_vlog_config_internal -labsl_log_internal_fnmatch -labsl_
raw_hash_set -labsl_hash -labsl_city -labsl_low_level_hash -labsl_hashtablez_sampler -labsl_random_distributions -labsl_random_seed_sequences -labsl_rand
om_internal_entropy_pool -labsl_random_internal_randen -labsl_random_internal_randen_hwaes -labsl_random_internal_randen_hwaes_impl -labsl_random_interna
l_randen_slow -labsl_random_internal_platform -labsl_random_internal_seed_material -lbcrypt -labsl_random_seed_gen_exception -labsl_statusor -labsl_statu
s -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_exponential_biased -labsl_cordz_handle -labsl_crc_cord_state -labsl_cr
c32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_leak_check -labsl_strerror -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_int
ernal -labsl_kernel_timeout_internal -labsl_stacktrace -labsl_symbolize -ldbghelp -labsl_debugging_internal -labsl_demangle_internal -labsl_demangle_rust
-labsl_decode_rust_punycode -labsl_utf8_for_code_point -labsl_malloc_internal -labsl_tracing_internal -labsl_time -labsl_civil_time -labsl_time_zone -lu
tf8_validity -lutf8_range -labsl_strings -labsl_strings_internal -labsl_string_view -labsl_int128 -labsl_base -ladvapi32 -labsl_spinlock_wait -labsl_thro
w_delegate -labsl_raw_logging_internal -labsl_log_severity
ld.lld: error: undefined symbol: __emutls_v._ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E
>>> referenced by C:/Users/spn/AppData/Local/Temp/agar_v26-47a1f9.o:(.refptr.__emutls_v._ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
What does gcm clang++ print?
It should be C:\msys64\mingw64\bin\clang++.exe, but it's probably not
yeah just asked gpt
I gotta go, will reply later 🙂
i hope it works

ye wtf
gpt says just rebulid whole shit with g++ again
Can you paste this as text so I can google the error?
.pb.cc:(.rdata$.refptr.__emutls_v._ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E[.refptr.__emutls_v._ZN6google8protobuf8internal15ThreadSa
feArena13thread_cache_E]+0x0): undefined reference to `__emutls_v._ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E'
collect2.exe: error: ld returned 1 exit status
lmao nothing on google @karmic viper
Try with -DGOOGLE_PROTOBUF_NO_THREADLOCAL
Didn't include them from where?
From pkg-config output?
ye
If so, try adding them first, and ignore -DGOOGLE_PROTOBUF_NO_THREADLOCAL for now
But why?
idk i thought only those with -l
All of them
it compiled 💀💀💀💀
🔥
fr at day 4
Btw, you tried static linking before. To do that, both add --static to pkg-config (it'll probably print even more flags), and also pass -static to the compiler
shall i try rn ?
tho

Yeah. Or you can just copy dlls next to your executable, and zip them together
nah static seems better
lemme try just do -static before compiling and see if it compiles
then check pkg-config
Even if it happens to work now, it's not supposed to work in general
ye doesnt compile
ok so i did this
lemme try copy
it compiled with -static flag now 🔥 @karmic viper
wait so how to use pkg_config again ?
Wdym, you just used it?
i mean if i needed other stuff
like what it does is search what dependencies another dependency is using
The library names you pass to it, like absl_log and protobuf, correspond to files in C:\msys64\mingw64\lib\pkgconfig
So e.g. when you give it absl_log, it loads the flags from the file named absl_log.pc in that directory. Most libraries include those .pc files
ah
thanks bro i thought i will never solve it 
well
if i wanna include zlib
do same steps if i get any error
Yeah, same steps should work.
https://packages.msys2.org/packages/mingw-w64-x86_64-zlib here you can see that it includes zlib.pc, so pkg-config should understand zlib once you install this package
pacman -S mingw-w64-x86_64-zlib
seems like its already installed
if i wanted to include it
just do
-lzlib ?
Run pkg-config --libs --cflags zlib and see what it tells you
@hexed isle Has your question been resolved? If so, type !solved :)
!solved
use a real ide