cmd.exe nach Start des Programms
-
Hallo,
wenn ich einen Doppelklick auf main.exe mache, dann startet er mir cmd.exe und mein Programm.
Der Fehlerm liegt in der dll.h, aber wenn ich das #include <iostream> weglasse, kommen diese Fehlermeldungen:-------------- Build: Debug in application ---------------
Compiling: main.cpp
In file included from E:\CodeBlocks\api\main.cpp:2:
E:\CodeBlocks\api\dll.h:16: error: using-declaration for non-member at class scope
E:\CodeBlocks\api\dll.h:16: error: expected;' before "log" E:\\CodeBlocks\\api\\dll.h:17: error: using-declaration for non-member at class scope E:\\CodeBlocks\\api\\dll.h:17: error: expected;' before "cfg"
E:\CodeBlocks\api\dll.h:18: error: using-declaration for non-member at class scope
E:\CodeBlocks\api\dll.h:18: error: expected;' before "sourcefolder" E:\\CodeBlocks\\api\\dll.h:27: error:std::string' has not been declared
E:\CodeBlocks\api\dll.h:27: error: ISO C++ forbids declaration of `stl' with no type
Process terminated with status 1 (0 minutes, 1 seconds)
8 errors, 0 warningsWie kann ich das Fenster wegbekommen, ohne dass es diese Fehlermeldungen gibt.
dll.h:
#ifndef _DLL_H_ #define _DLL_H_ #include <windows.h> #include <iostream> #include <stdio.h> #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else /* Not BUILDING_DLL */ # define DLLIMPORT __declspec (dllimport) #endif /* Not BUILDING_DLL */ struct konfig { std::string log; //location of Log std::string cfg; //location of config if not \\konfig.cfg std::string sourcefolder; //location of Testbenchdump }; class DLLIMPORT DllClass { public: DllClass(char Logfile[100],char Konfigfile[100]); virtual ~DllClass(void); bool log(std::string stl); private: }; #endif /* _DLL_H_ */
-
sulpsulpc schrieb:
Der Fehlerm liegt in der dll.h
Nein, der "Fehler" liegt in deinen Compilereinstellungen. Es wird als Konsolenprogramm kompiliert.
Unter Visual Studio ändert man das z.B. unter Project -> Properties -> Configuration Properties -> Linker -> System -> Subsystem auf Windows umstellen.
-
Und es fehlt der #include <string>