User forums > Help
codeblocks 8.02 and Visual C++ Toolkit 2003 prob
chaser:
Hi
sorry my english is terrible im from germany and need help :cry:
I have to learn gameprogramming c++ book,on the cd is CodeBlocks-1.0rc2 + Platform sdk + Visual C++ Toolkit 2003 ,all i have install and work.
I have see codeblocks 8.02 and install this, and i have problems with codeblocks 8.02 to compile Hello script :?
in the book settings
Selected compiler
Microsoft Visual C++ Toolkit 2003
Compiler Flags :
Enable warnings level 3
Maximize speed
Enable c++ Exception Handling
_cdecl calling convention
Single-threaded Runtime Libary
Search Directories
Compiler:
C:\Programme\Microsoft Platform SDK\Include
C:\Programme\Microsoft Visual C++ Toolkit 2003\include
Linker:
C:\Programme\Microsoft Platform SDK\Lib
C:\Programme\Microsoft Visual C++ Toolkit 2003\lib
I´m Confused
CodeBlocks-1.0rc2 compiler work no problems
codeblocks 8.02 compile not work :cry:
||=== dad, Debug ===|
LINK||fatal error LNK1181: cannot open input file 'libcmtd.lib'|
||=== Build finished: 1 errors, 0 warnings ===|
need help :!:
MortenMacFly:
--- Quote from: chaser on April 16, 2008, 10:54:15 am ---Microsoft Visual C++ Toolkit 2003
[...]
LINK||fatal error LNK1181: cannot open input file 'libcmtd.lib'|
--- End quote ---
The MS Visual C++ 2003 toolkit does not ship with the debug libraries IMHO. You are trying to link against a debug version of the cmt library (libcmtd.lib). Either you get the debug libs from somewhere or change this to "libcmt.lib".
chaser:
hi
ehmmm i have search
Where can I change libcmtd.lib to libcmt.lib in codeblocks 8.02 ??
I have found nothing with these entry libcmtd.lib
I find it strange
-----------------------------
i have delete codeblocks all and new install
and all options set
by compile
He say
LINK||warning LNK4098: defaultlib 'LIBC' conflicts with use of other libs; use /NODEFAULTLIB:library|
||=== Build finished: 0 errors, 1 warnings ===|
Where do I have to register ( use /NODEFAULTLIB:library| )
I am silly :cry:
chaser:
:? :( :( :?
I have from book CD
startet in codeblocks 8.02 Hello Windows.cbp
and i have no problems with build and run with the Windows.cbp to windows.exe
:shock:
so i have made a new Project with the Windows.cbp code
--- Code: ---// Dieses Programm zeigt ein einfaches Windows-Programm
// Headerdatei
#include <windows.h>
// Anwendungsfenster erzeugen
HWND CreateMainWindow(HINSTANCE hInstance);
// Callback Funktion zur Nachrichtenbehandlung
LRESULT CALLBACK MessageHandler(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
// Das Fensterhandle
HWND hWnd = 0;
// Windows main-Funktion
int WINAPI WinMain(HINSTANCE hInstance, // Handle der Programminstanz
HINSTANCE hPrevInstance, // Handle der letzten Instanz
LPSTR lpCmdLine, // Kommandozeile
int nCmdShow) // Art wie das Fenster angezeigt werden soll
{
// Fenster erzeugen und Handle speichern
hWnd = CreateMainWindow(hInstance);
// Wenn der Rueckgabewert 0 ist, ist ein Fehler aufgetreten
if(0 == hWnd)
{
MessageBox(0, "Fenster konnte nicht erzeugt werden", "Fehler", MB_OK);
return 0;
}
// Struktur, in der Informationen zur Nachricht gespeichert werden
MSG msg;
// Diese Schleife laeuft bis die Nachricht WM_QUIT empfangen wird
while(GetMessage(&msg, NULL, 0, 0))
{
// Nachricht an die Callbackfunktion senden
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// Rueckgabewert an Windows
return 0;
}
HWND CreateMainWindow(HINSTANCE hInstance)
{
WNDCLASSEX wndClass =
{
sizeof(WNDCLASSEX), // Groesse angeben
CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW, // Standardstile
MessageHandler, // Callback-Funktion
0, // Zusaetzliche Angaben
0, // nicht benoetigt
hInstance, // Anwendungsinstanz
LoadIcon(NULL, IDI_WINLOGO), // Windows-Logo
LoadCursor(NULL, IDC_ARROW), // Normaler Cursor
(HBRUSH)GetStockObject(WHITE_BRUSH), // Weisser Pinsel
NULL, // kein Menue
"WindowClass", // Der Name der Klasse
LoadIcon(NULL, IDI_WINLOGO) // Windows Logo
};
RegisterClassEx(&wndClass);
return CreateWindowEx(NULL, // Keine erweiterten Stile nutzen
"WindowClass", // Klassenname
"Hello Windows", // Fenstertitel
WS_OVERLAPPEDWINDOW | // Fenster
WS_VISIBLE, // Eigenschaften
100, 100, 400, 300, // Anfangsposition und Groesse
NULL, // Handle des Elternfensters
NULL, // Handle des Menues
hInstance, // Anwendungsinstanz
NULL); // wird nicht benoetigt
}
// Diese Funktion wird von Windows aufgrufen, wenn eine Nachricht
// fuer Ihr Programm vorliegt
LRESULT CALLBACK MessageHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// testen, um welche Nachticht es sich handelt
switch(msg)
{
// wenn das Fenster geschlossen wird, eine Nachricht senden,
// die das Programm beendet
case WM_DESTROY:
PostQuitMessage(0);
return 0;
break;
}
// Wenn wir uns nicht um die Nachricht gekuemmert haben
// wird sie an die Standardnachrichtenverarbeitung von Windows
// geschickt
return DefWindowProc(hwnd, msg, wParam, lParam);
}
--- End code ---
and by build com this !
--- Code: ----------------- Build: Release in rtjujg ---------------
main.cpp
Linking console executable: bin\Release\rtjujg.exe
main.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall MessageHandler(struct HWND__ *,unsigned int,unsigned int,long)" (?MessageHandler@@YGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall MessageHandler(struct HWND__ *,unsigned int,unsigned int,long)" (?MessageHandler@@YGJPAUHWND__@@IIJ@Z)
main.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "struct HWND__ * __cdecl CreateMainWindow(struct HINSTANCE__ *)" (?CreateMainWindow@@YAPAUHWND__@@PAUHINSTANCE__@@@Z)
main.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function "struct HWND__ * __cdecl CreateMainWindow(struct HINSTANCE__ *)" (?CreateMainWindow@@YAPAUHWND__@@PAUHINSTANCE__@@@Z)
main.obj : error LNK2019: unresolved external symbol __imp__GetStockObject@4 referenced in function "struct HWND__ * __cdecl CreateMainWindow(struct HINSTANCE__ *)" (?CreateMainWindow@@YAPAUHWND__@@PAUHINSTANCE__@@@Z)
main.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "struct HWND__ * __cdecl CreateMainWindow(struct HINSTANCE__ *)" (?CreateMainWindow@@YAPAUHWND__@@PAUHINSTANCE__@@@Z)
main.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function "struct HWND__ * __cdecl CreateMainWindow(struct HINSTANCE__ *)" (?CreateMainWindow@@YAPAUHWND__@@PAUHINSTANCE__@@@Z)
main.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16
main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxA@16 referenced in function _WinMain@16
bin\Release\rtjujg.exe : fatal error LNK1120: 11 unresolved externals
Process terminated with status 1120 (0 minutes, 0 seconds)
12 errors, 0 warnings
--- End code ---
:shock: :| :| :cry:
dje:
Hi !
You need to include windows libraries in your linker settings.
Search google for your undefined references and you'll know what lib to add; for example:
RegisterClassEx needs User32.lib
Dje
Navigation
[0] Message Index
[#] Next page
Go to full version