DLL-erstellung: .lib-datei wird nicht erstellt
-
Hallo,
ich habe mal versucht, etwas mit dll herumzuspielen, um zu probieren, wie das so funktioniert. Jetzt habe ich ein Projekt als Win32-Konsolenanwendung erstellt und VS2013 gesagt, dass er/sie/es das Projekt als Dynamic Link Library kompilieren soll. Beim Einbinden ist dann der Fehler aufgefallen: ich kann unter "Projekt - Eigenschaften - Konfigurationseigenschaften - Linker - zusätzliche Bibliotheksverzeichnisse" die bibliotheksdatei (.lib) des dll-Projektes nicht einbinden, weil es diese nicht gibt. Normalerweise müsste die ja mit der dll im "Debug"- bzw. "Release"-Ordner sein, oder? Dort ist sie nicht und auch in keinem anderen Ordner des Projektes. Ich würde das ganze auf einen Bug von VisualStudio zurück führen, aber vielleicht habe ich ja was falsch gemacht.Der Code, der in dem dll-projekt steht:
MapManager.h:
#include <string> #include <vector> #include <fstream> #include <iostream> #include <Windows.h> #include <SFML\Graphics.hpp> #include "GameMap.h" class GameMap; namespace Map { class Manager { public: static std::string loadMapsFromRegistry(); static std::string loadSelectedMap(int selectedMapIndex); static void handleMap(float elapsedTime); static void giveDebugInformation(); static std::string getMapRegistryPath(); private: static std::string m_MapRegistryPath; static std::vector<GameMap> m_MapVector; }; }MapManager.cpp:
#include "MapManager.h" namespace Map { std::string Manager::m_MapRegistryPath = "data/maps/registry.mreg"; std::vector<GameMap> Manager::m_MapVector; std::string Manager::loadMapsFromRegistry() { std::fstream mreg; mreg.open(m_MapRegistryPath, std::ios::in | std::ios::binary); if (!mreg) { mreg.close(); MessageBox(NULL, L"ERROR_ Map::Manager: failed to open Mapregistryfile!\n***Please check if the file was deleted!", NULL, MB_OK); return "ERROR_ Map::Manager: failed to open Mapregistryfile!\n***Please check if the file was deleted!"; } else{ std::string header = ""; int mapsCout = 0; std::string mapName = ""; std::string mapPath = ""; std::string mapCreator = ""; std::string mapDate = ""; std::string mapRecommendedGamemode = ""; mreg >> header; if (header == "ccmapregistry") { mreg >> mapsCout; for (int i = 0; i < mapsCout; i++) { mreg >> mapName; mreg >> mapPath; mreg >> mapCreator; mreg >> mapDate; mreg >> mapRecommendedGamemode; Map::GameMap newMap; newMap.setName(mapName); newMap.setPath(mapPath); newMap.setCreator(mapCreator); newMap.setCreationDate(mapDate); newMap.setRecommendedGamemode(mapRecommendedGamemode); m_MapVector.push_back(newMap); } return "MESSAGE_ Map::Manager: successfully loaded maps from mapregistry!"; } else{ return "ERROR_ Map::Manager: can not read file!\n"; } } } std::string Manager::getMapRegistryPath() { return m_MapRegistryPath; } void Manager::giveDebugInformation() { for (int i = 0; i < m_MapVector.size(); i++) { std::cout << "Map [" << i << "] (" << m_MapVector[i].getName() << "):" << std::endl; std::cout << "Creator:\t\t" << m_MapVector[i].getCreator() << std::endl; std::cout << "CreateDate:\t\t" << m_MapVector[i].getCreationDate() << std::endl; std::cout << "recommended Gamemode:" << m_MapVector[i].getRecommendedGamemode() << std::endl; } } }GameMap.h:
#include <vector> #include <fstream> #include <iostream> #include <Windows.h> #include <SFML\Graphics.hpp> namespace Map { class GameMap { public: GameMap(); std::string load(); void Update(); void Render(sf::RenderWindow &App); //GETTER std::string getName(); std::string getPath(); std::string getCreator(); std::string getCreationDate(); std::string getRecommendedGamemode(); //SETTER void setName(std::string value); void setPath(std::string value); void setCreator(std::string value); void setCreationDate(std::string value); void setRecommendedGamemode(std::string value); private: std::string m_Name; std::string m_Path; std::string m_Creator; std::string m_CreationDate; std::string m_RecommendedGamemode; }; }GameMap.cpp:
#include "GameMap.h" namespace Map { GameMap::GameMap() { } std::string GameMap::load() { //load return ""; } //GETTER std::string GameMap::getName() { return m_Name; } std::string GameMap::getPath() { return m_Path; } std::string GameMap::getCreator() { return m_Creator; } std::string GameMap::getCreationDate() { return m_CreationDate; } std::string GameMap::getRecommendedGamemode() { return m_RecommendedGamemode; } //SETTER void GameMap::setName(std::string value) { m_Name = value; } void GameMap::setPath(std::string value) { m_Path = value; } void GameMap::setCreator(std::string value) { m_Creator = value; } void GameMap::setCreationDate(std::string value) { m_CreationDate = value; } void GameMap::setRecommendedGamemode(std::string value) { m_RecommendedGamemode = value; } }FileWriter.h:
#include <vector> #include <fstream> #include <iostream> #include <Windows.h> #include <SFML\Graphics.hpp> #include "MapManager.h" namespace Map { class FileWriter { public: static void newMapRegistryEntry(std::string name, std::string path, std::string creator, std::string creationDate, std::string recommendedGamemode); private: }; }FileWriter.cpp:
#include "FileWriter.h" namespace Map { void FileWriter::newMapRegistryEntry(std::string name, std::string path, std::string creator, std::string creationDate, std::string recommendedGamemode) { std::fstream mreg; mreg.open(Manager::getMapRegistryPath(), std::ios::out | std::ios::app | std::ios::binary); if (!mreg) { MessageBox(NULL, L"ERROR_ Map::FileWriter: failed to open Mapregistryfile!\n***Please check if the file was deleted!", NULL, MB_OK); } else{ CopyFile(L"data/maps/registry.mreg", L"Backups/mapRegistry.mreg", NULL); std::string header; mreg >> header; if (header == "ccmapregistry") { mreg << name; mreg << path; mreg << creator; mreg << creationDate; mreg << recommendedGamemode; MessageBox(NULL, L"MESSAGE_ Map::FileWriter: edited mapRegistry!", NULL, MB_OK); } else{ MessageBox(NULL, L"ERROR_ Map::FileWriter: can not read mapRegistry-file!", NULL, MB_OK); } } mreg.close(); } }Ich glaube zwar nicht, dass es an meinem Code liegt, aber vielleicht irre ich mich ja

Ich hoffe, mir kann da jemand bei helfen!
LG,
Hegad
-
Dieser Thread wurde von Moderator/in SeppJ aus dem Forum C++ (alle ISO-Standards) in das Forum Compiler- und IDE-Forum verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
Hallo,
du exportierst ja auch keine Symbole, daher wird auch keine LIB-Datei erstellt - s.a.
How do I build an import library (.lib) AND a DLL in Visual C++?
Exemplarische Vorgehensweise: Erstellen und Verwenden einer Dynamic Link Library (C++)
(Stichwort: __declspec(dllexport))
-
Th69 schrieb:
Hallo,
du exportierst ja auch keine Symbole, daher wird auch keine LIB-Datei erstellt - s.a.
How do I build an import library (.lib) AND a DLL in Visual C++?
Exemplarische Vorgehensweise: Erstellen und Verwenden einer Dynamic Link Library (C++)
(Stichwort: __declspec(dllexport))Ok, kaum macht man es richtig, funktioniert es auf einmal

Danke für die schnelle Antwort!LG,
Hegad