heres the Build Log:
"-------------- Clean: Debug in classcontrols (compiler: GNU GCC Compiler)---------------
Cleaned "classcontrols - Debug"
-------------- Build: Debug in classcontrols (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -g -c C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp -o obj\Debug\main.o
g++.exe -o bin\Debug\classcontrols.exe obj\Debug\main.o -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 -lgdi32 -luser32 -lkernel32 -lcomctl32 "..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libmsimg32.a" "..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libwinmm.a" "..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libgdiplus.a" "..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libgdi32.a" "C:\Program Files (x86)\CodeBlocks\MinGW\i686-w64-mingw32\lib\libbgi.a" -mwindows
In file included from C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp:1:
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h: In static member function 'static LRESULT label::WndProcLabel(HWND, UINT, WPARAM, LPARAM)':
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h:2077:43: warning: comparison of integer expressions of different signedness: 'color' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
if (inst->clrBackColor==-1)
~~~~~~~~~~~~~~~~~~^~~~
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h: In member function 'void form::setParent(HWND)':
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h:2949:118: warning: passing NULL to non-pointer argument 1 of 'HWND__* CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)' [-Wconversion-null]
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, mod, this);
^
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h: In static member function 'static LRESULT form::WndProcForm(HWND, UINT, WPARAM, LPARAM)':
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h:2994:24: warning: unused variable 'KeyDownCount' [-Wunused-variable]
static int KeyDownCount=0;
^~~~~~~~~~~~
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp: At global scope:
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp:9:14: error: redefinition of 'std::__cxx11::wstring towstring(const string&)'
std::wstring towstring(const std::string& v)
^~~~~~~~~
In file included from C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp:1:
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\cambalinho.h:359:14: note: 'std::__cxx11::wstring towstring(const string&)' previously defined here
std::wstring towstring(const std::string& v)
^~~~~~~~~
C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp:19:7: error: redefinition of 'class image'
class image
^~~~~
In file included from C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp:1:
"
theres much more.. but it's too big :(
i did these project before and i know that it's working.. but maybe, now, the problem is the Linker Options.
what you can advice me?
My guess is you are mixing two compiler toolchains together; that can result in weird errors like you got.
Link to how to use code tags https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (https://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)
Edit: The reason I think two tool chains are being used.
C:\Program Files (x86)\CodeBlocks\MinGW\i686-w64-mingw32\lib
"..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libwinmm.a"
Tim S.
1st warning:
hwnd = CreateWindowEx(NULL, classname, strCaption.c_str(),WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, nullptr, mod, this);
"cambalinho.h|2949|warning: passing NULL to non-pointer argument 1 of 'HWND__* CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)' [-Wconversion-null]|"
1st error:
std::wstring towstring(const std::string& v)
{
std::wstring out(v.size()+1,L'\0');
int size = MultiByteToWideChar(CP_UTF8, 0, v.c_str(), -1, &out[0], out.size());
out.resize(size-1);
return out;
}
"main.cpp|9|error: redefinition of 'std::__cxx11::wstring towstring(const string&)'|"
Decide which toolchain you wish to use; then only use that one!
Re-read my last post, I edited it.
Tim S.
yes... was on Project Build Options... i change it. thanks for that.
but the same errors\warnings continues
Please post the build log with at least the first error and up to three warning above it and post the next two lines down[below the error].
You cutting up the build log makes it impossible to help you!
Tim S.
heres the log and messages on zip file and the H file.
You have to stop using libraries from two different toolchains.
Tim S.
Is the g++.exe from 64 or 32 bit mingw compiler?
Are you using an 64 bit or 32 bit CB?
Tim S.
both 32 bits.
i found some errors that i didn't notice: the image class, for exemple, is redefinided.
i can fix these ;)
Please try using this way to do static library usage
$(TARGET_COMPILER_DIR)/i686-w64-mingw32/lib/libmsimg32.a
Instead of doing this way!
"..\..\..\..\..\Program Files\CodeBlocks\mingw32\i686-w64-mingw32\lib\libmsimg32.a"
You need to use *only* a single toolchain!!!!
Tim S.
Quote from: cambalinho on November 11, 2023, 03:03:40 PM
i found some errors that i didn't notice: the image class, for exemple, is redefinided.
i can fix these ;)
Yes, fix those errors and then try my prior post suggestion.
Tim S.
done!!
now lets go to another error:
a.KeyDown=[](int key, int repeat)
{
if(CombinationKeys({'A','S'},{'W'},{'R','T'}, {'O','P'})==true)
{
a.Text="hello world";
MessageBox(NULL,"hi", "hello",MB_OK);
}
if(key==VK_ESCAPE)
End();
};
'a' it's from 'form' class:
//KeyBoard events:
event(KeyDown, (int *Key, int repeat)) = [](int *Key, int repeat) {;};
from:
#define event(EventName, ... ) std::function<void(__VA_ARGS__ )> EventName
now i get the error here:
a.KeyDown=[](int key, int repeat)
{
if(CombinationKeys({'A','S'},{'W'},{'R','T'}, {'O','P'})==true)
{
a.Text="hello world";
MessageBox(NULL,"hi", "hello",MB_OK);
}
if(key==VK_ESCAPE)
End();
};
"C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp|73|error: no match for 'operator=' (operand types are 'std::function<void(int*, int)>' and 'WinMain(HINSTANCE, HINSTANCE, LPSTR, int)::<lambda(int, int)>')|"
what i'm doing wrong?
Quote from: cambalinho on November 11, 2023, 03:43:36 PM
"C:\Users\Utilizador\Documents\CodeBlocks\classcontrols\main.cpp|73|error: no match for 'operator=' (operand types are 'std::function<void(int*, int)>' and 'WinMain(HINSTANCE, HINSTANCE, LPSTR, int)::<lambda(int, int)>')|"
what i'm doing wrong?
I can not help you with that; I have forgotten more C++ than I remember.
And, that is a C++ type problem, my skill is fixing build issues.
I still have problems with the idea that others can not understand build errors that are simple to me.
Tim S.
yes.. now it's fixed:
a.KeyDown=[](int *key, int repeat)
{
if(CombinationKeys({'A','S'},{'W'},{'R','T'}, {'O','P'})==true)
{
a.Text="hello world";
MessageBox(NULL,"hi", "hello",MB_OK);
}
if(*key==VK_ESCAPE)
End();
};
it's a pointer.. that's my error :(
now i have more 2 Warnings:
1)
if (inst->clrBackColor==-1)
"warning: comparison of integer expressions of different signedness: 'color' {aka 'long unsigned int'} and 'int' [-Wsign-compare]|"
i use '-1' for transparent... can i avoid these warning?
2)hwnd = CreateWindowEx(NULL, classname, strCaption.c_str(),WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, mod, this);
"warning: passing NULL to non-pointer argument 1 of 'HWND__* CreateWindowExA(DWORD, LPCSTR, LPCSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)' [-Wconversion-null]|"
i don't know avoid these 2 warnings :(