Author Topic: codeblocks 8.02 and Visual C++ Toolkit 2003 prob  (Read 16482 times)

chaser

  • Guest
codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« on: April 16, 2008, 10:54:15 am »
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  :!:

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #1 on: April 16, 2008, 03:29:36 pm »
Microsoft Visual C++ Toolkit 2003
[...]
LINK||fatal error LNK1181: cannot open input file 'libcmtd.lib'|
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".
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

chaser

  • Guest
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #2 on: April 17, 2008, 09:59:13 am »
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:

« Last Edit: April 17, 2008, 10:38:43 am by chaser »

chaser

  • Guest
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #3 on: April 18, 2008, 11:26:57 am »
 :? :( :( :?

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);
}


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
 

 :shock: :| :| :cry:

Offline dje

  • Lives here!
  • ****
  • Posts: 683
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #4 on: April 18, 2008, 11:49:15 am »
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

chaser

  • Guest
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #5 on: April 18, 2008, 01:33:46 pm »
i have add User32.lib to linker and error´s

so i have made  a new project  with self code and
i have charge from the wa.cbp
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="wa" />
<Option pch_mode="2" />
<Option compiler="msvctk" />
<Build>
<Target title="Debug">
<Option output="bin\Debug\wa" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="1" />
<Option compiler="msvctk" />
<Compiler>
<Add option="/Zi" />
<Add option="/D_DEBUG" />
<Add option="/MTd" />
</Compiler>
<Linker>
<Add option="/DEBUG" />
<Add library="libcmtd.lib" />
<Add library="libcpmtd.lib" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin\Release\wa" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Release\" />
<Option type="1" />
<Option compiler="msvctk" />
<Compiler>
<Add option="/Og" />
<Add option="/Ox" />
<Add option="/DNDEBUG" />
<Add option="/MT" />
</Compiler>
<Linker>
<Add library="libcmt.lib" />
<Add library="libcpmt.lib" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="/W3" />
<Add option="/EHsc" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

to from a old  scource  cpb
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
    <FileVersion major="1" minor="2" />
    <Project>
        <Option title="wa" />
        <Option pch_mode="0" />
        <Option compiler="1" />
        <Build>
            <Target title="default">
                <Option output="wa.exe" />
                <Option type="0" />
                <Option compiler="1" />
                <Option includeInTargetAll="1" />
                <Option projectResourceIncludeDirsRelation="-1" />
            </Target>
        </Build>
        <Linker>
            <Add library="gdi32" />
            <Add library="user32" />
            <Add library="kernel32" />
        </Linker>
        <Unit filename="main.cpp">
            <Option compilerVar="CPP" />
            <Option target="default" />
        </Unit>
    </Project>
</CodeBlocks_project_file>
and i can compile
i have not include lib  User32.lib
and he work , i can build  no errrors  :shock:


   
What settings should I do in  codeblocks 8.02 ?

 :?

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #6 on: April 18, 2008, 01:41:13 pm »
Quote
What settings should I do in  codeblocks 8.02 ?

It seems obviuos to me that you are using these libraries in the second project (which is running fine) and they aren't included for the first one:

Code
<Add library="gdi32" />
<Add library="user32" />
<Add library="kernel32" />

So, maybe adding those libraries to your build targets in your project could solve your problems.

Regards.
Those who were seen dancing were thought to be insane by those who could not hear the music

chaser

  • Guest
Re: codeblocks 8.02 and Visual C++ Toolkit 2003 prob
« Reply #7 on: April 18, 2008, 02:37:52 pm »
sorry  i have  errors  on the pc and laptop  to build  :?

over 4 day´s  i have lock and search to this problems with the  newer  codeblocks 8.02

sorry  Since I am a beginner  :P

Where is the difference between CodeBlocks-1.0rc2  to codeblocks 8.02

It may not be at CodeBlocks-1.0rc2  work build no problems make
and codeblocks 8.02 make  many problems

sorry I would like to know what everything is set to be not that I in a few days again had problems