Hi community,
im programming a small game. There is a backend, written in C++ (server and stuff), which is quite complex. Now i want to integrate some stuff in an c++ module. The code works standalone.
So i wanted to import it as a static library, which is all in all easier for me. The library itself wont change that mutch, so a static library for me is ok.
I also was able to compile the tutorial-like summator-example. But when i add my code, i cant compile it anymore.
Im using godot 3.4.2 stable.
This is my folder structure:
Engine/modules/NetworkManager/lib/NetworkClientLibrary.lib
Engine/modules/NetworkManager/lib/NetworkClientLibrary.windows.tools.32.lib #this didnt fix it
godot/modules/NetworkManager/config.py
godot/modules/NetworkManager/NetworkManager.cpp
godot/modules/NetworkManager/NetworkManager.h
godot/modules/NetworkManager/register_types.cpp
godot/modules/NetworkManager/register_types.h
godot/modules/NetworkManager/SCsub`
NetworkManager .h
#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H
#include "core/reference.h"
#include"../../../Network/StarShooterNetwork/NetworkClient.h"
#include"../../../Network/StarShooterNetwork/PhysicsManager.h"
class NetworkManager : public Reference {
GDCLASS(NetworkManager, Reference);
int count;
protected:
static void _bind_methods();
public:
void add(int p_value);
void reset();
int get_total() const;
NetworkManager();
void update();
private:
NetworkClient networkClient;
PhysicsManager physicsManager;
};
NetworkManager.cpp //small portion of it
void NetworkManager::_bind_methods() {
ClassDB::bind_method(D_METHOD("add", "value"), &NetworkManager::add);
ClassDB::bind_method(D_METHOD("reset"), &NetworkManager::reset);
ClassDB::bind_method(D_METHOD("get_total"), &NetworkManager::get_total);
ClassDB::bind_method(D_METHOD("update"), &NetworkManager::update);
}
void NetworkManager::update()
{
size_t maxMessages = 1000;
networkClient.update(maxMessages);
physicsManager.updatePhysics();
}
SCONS
Import('env')
env_module = env.Clone()
env_module.add_source_files(env.modules_sources, "*.cpp") # Add all cpp files to the build
env_module.Append(CPPPATH=["../../../Network/asio/include", "../../../Network/StarShooterNetwork"])
env.Append(LIBPATH=['lib'])
env.Append(LIBS='NetworkClientLibrary') `
If i run scons --clean, and then scons p=windows tools=yes bits=32 -j4 this happens:
scons: Reading SConscript files ...
Configuring for Windows: target=debug, bits=32
Found MSVC version 14.2, arch x86, bits=32
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[...]
[ 96%] Building compilation database compile_commands.json
[ 96%] Linking Program ==> bin\godot.windows.tools.32.exe
[ 97%] ows.tools.32.lib'
[ 97%] scons: *** [bin\godot.windows.tools.32.exe] Error 1181
scons: building terminated because of errors.
[Time elapsed: 00:00:34.580]
If i change the includes to #include "NetworkClient.h" etc I get an Error
[100%] Linking Program ==> bin\godot.windows.tools.32.exe
LINK : fatal error LNK1181: cannot open input file 'NetworkClientLibrary.windows.tools.32.lib'
scons: *** [bin\godot.windows.tools.32.exe] Error 1181
scons: building terminated because of errors.
[Time elapsed: 00:00:23.844]
I really dont know what to do, it will be a small error, but i cant find it. Has anybody an idea?
Greetings