Include file errors when compiling

General questions regarding the usage of CodeLite
User avatar
ColleenKobe
CodeLite Expert
Posts: 129
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Include file errors when compiling

Post by ColleenKobe »

Good morning. I am updating from CodeLite 12.3.0 to 17.4.0, and also to MinGW GCC 64 bit 7.1.0. I am using wxWidgets as well.

I have a CodeLite workspace with three projects, two C and one C++. The C projects appear to build fine (can't test them until the C++ project is built). The C++ project won't build. When the compiler compiles the first C++ file (Channel_Settings_Class.cpp), it goes to process the windows.h file (see below).

Code: Select all

#include <stdio.h>                      //  1 aa

#include <tchar.h>                      //  1 ab
// #include <C:\MinGW\x86_64-7.1.0-release-posix-seh-rt_v5-rev2\mingw64\x86_64-w64-mingw32\include\tchar.h>    //  1 ab

#include <windows.h>                    //  1 ac
// #include <C:\MinGW\x86_64-7.1.0-release-posix-seh-rt_v5-rev2\mingw64\x86_64-w64-mingw32\include\windows.h>    //  1 ac

#include "FTD3XX.h"                     //  2 ab

When MinGW processes the windows.h file, I get the error messages below when it tries to pull in the winuser.h file.

Code: Select all

C:/MinGW/x86_64-7.1.0-release-posix-seh-rt_v5-rev2/mingw64/bin/mingw32-make.exe -j4 -e -f  "Main.mk"  MakeIntermediateDirs && C:/MinGW/x86_64-7.1.0-release-posix-seh-rt_v5-rev2/mingw64/bin/mingw32-make.exe -j4 -e -f  "Main.mk"  ./Debug/Channel_Settings_Class.cpp.o
----------Building project:[ Main - Debug ] (Single File Build)----------
C:/MinGW/x86_64-7.1.0-release-posix-seh-rt_v5-rev2/mingw64/bin/g++.exe  -c  "F:/SBIR_Phase_II/Main/Channel_Settings_Class.cpp" -g -O0 -Wall -IC:/wxWidgets/lib/gcc_dll/mswud -IC:/wxWidgets/include -mthreads -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMSW__ -DHAVE_W32API_H -D_UNICODE -fmessage-length=0 -pipe    -o ./Debug/Channel_Settings_Class.cpp.o -I. -IC:/MinGW/include -IC:/wxWidgets/include -I. -I../Background -I../Behind_the_Scenes -I../Main -I../Resources -IG:/PF/IRT/UHSD/v3.a.3
In file included from C:/MinGW/x86_64-7.1.0-release-posix-seh-rt_v5-rev2/mingw64/x86_64-w64-mingw32/include/windows.h:72:0,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.cpp:28:
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':
C:/wxWidgets/include/wx/msw/winundef.h:46:20: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'
             return CreateDialogW(hInstance, pTemplate, hwndParent, pDlgProc);
                    ^
In file included from C:/wxWidgets/include/wx/afterstd.h:16:0,
                 from C:/wxWidgets/include/wx/stringimpl.h:67,
                 from C:/wxWidgets/include/wx/unichar.h:15,
                 from C:/wxWidgets/include/wx/strvararg.h:19,
                 from C:/wxWidgets/include/wx/string.h:37,
                 from C:/wxWidgets/include/wx/memory.h:15,
                 from C:/wxWidgets/include/wx/object.h:19,
                 from C:/wxWidgets/include/wx/wx.h:15,
                 from F:/SBIR_Phase_II/Main/Digital_Count_Class.h:32,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.h:28,
                 from F:/SBIR_Phase_II/Main/MainFrame_Class.h:31,
                 from F:/SBIR_Phase_II/Main/utg.h:29,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.cpp:36:
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':
C:/wxWidgets/include/wx/msw/winundef.h:77:48: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'
                                family, facename);
                                                ^
In file included from C:/MinGW/x86_64-7.1.0-release-posix-seh-rt_v5-rev2/mingw64/x86_64-w64-mingw32/include/windows.h:72:0,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.cpp:28:
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':
C:/wxWidgets/include/wx/msw/winundef.h:102:20: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'
             return CreateWindowW(lpClassName, lpWndClass, dwStyle, x, y, w, h,
                    ^
In file included from C:/wxWidgets/include/wx/afterstd.h:16:0,
                 from C:/wxWidgets/include/wx/stringimpl.h:67,
                 from C:/wxWidgets/include/wx/unichar.h:15,
                 from C:/wxWidgets/include/wx/strvararg.h:19,
                 from C:/wxWidgets/include/wx/string.h:37,
                 from C:/wxWidgets/include/wx/memory.h:15,
                 from C:/wxWidgets/include/wx/object.h:19,
                 from C:/wxWidgets/include/wx/wx.h:15,
                 from F:/SBIR_Phase_II/Main/Digital_Count_Class.h:32,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.h:28,
                 from F:/SBIR_Phase_II/Main/MainFrame_Class.h:31,
                 from F:/SBIR_Phase_II/Main/utg.h:29,
                 from F:/SBIR_Phase_II/Main/Channel_Settings_Class.cpp:36:
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':
C:/wxWidgets/include/wx/msw/winundef.h:119:44: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'
             return LoadMenuW(instance, name);
                                            ^
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HWND__* FindText(LPFINDREPLACE)':
C:/wxWidgets/include/wx/msw/winundef.h:134:43: error: cannot convert 'LPFINDREPLACE {aka tagFINDREPLACEA*}' to 'LPFINDREPLACEW {aka tagFINDREPLACEW*}' for argument '1' to 'HWND__* FindTextW(LPFINDREPLACEW)'
             return FindTextW(lpfindreplace);
                                           ^
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':
C:/wxWidgets/include/wx/msw/winundef.h:310:51: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'
             return LoadIconW(hInstance, lpIconName);
                                                   ^
C:/wxWidgets/include/wx/msw/winundef.h: In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':
C:/wxWidgets/include/wx/msw/winundef.h:323:55: error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'
             return LoadBitmapW(hInstance, lpBitmapName);
                                                       ^
mingw32-make.exe: *** [Main.mk:104: Debug/Channel_Settings_Class.cpp.o] Error 1
==== build ended with errors (7 errors, 4 warnings) ===

These errors occur from the MinGW h files. I have always assumed these files should never be edited by a user like me. I don't know what to do to get rid of these errors.

Could there be another h file I should include before including the windows.h file? If so, what should it be?

Could I be missing or using the wrong path for the compilation process? My current Environment Variables are:

Code: Select all

set CodeLiteDir=C:\CodeLite
set WXCFG=gcc_dll/mswud
set WXWIN=C:\wxWidgets

My Windows 10 system path includes the directories (among others):

Code: Select all

C:\MinGW\x86_64-7.1.0-release-posix-seh-rt_v5-rev2\mingw64\bin;
C:\MinGW\x86_64-7.1.0-release-posix-seh-rt_v5-rev2\mingw64\include;
C:\wxWidgets\include;
C:\wxWidgets\lib\gcc_dll;

Or should I be using a different MinGW entirely?

Suggestions?

Colleen

User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Include file errors when compiling

Post by eranif »

Make sure you have read the HOW TO POST thread
User avatar
ColleenKobe
CodeLite Expert
Posts: 129
Joined: Wed Mar 30, 2016 4:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Include file errors when compiling

Post by ColleenKobe »

I have downloaded wxWidgets version 3.2.2.1 into my C:\wxWidgets folder.
I have downloaded CodeLite version 17.0.0 into my C:\CodeLite folder.
I have downloaded the latest-and-greatest MinGW from the download site into my C:\MinGW folder.
I have downloaded MSYS2, the latest version into my C:\msys64 folder.
I am using Windows 10.

I made Windows Debug and Release builds of wxWidgets using the MSYS2 steps listed in the directions you give in your previous post.

Now I want to make a Debug SHARED build of my software.

When I go to my C:\wxWidgets directory and search for all occurrences of build.cfg in this directory tree, I get four hits:

Code: Select all

c:\wxWidgets\build-debug\lib\clang_x64_dll\mswud\build.cfg
c:\wxWidgets\build-debug\lib\clang_x64_dll\mswu\build.cfg
c:\wxWidgets\build-release\lib\clang_x64_dll\mswud\build.cfg
c:\wxWidgets\build-release\lib\clang_x64_dll\mswu\build.cfg

I chose c:\wxWidgets\build-debug\lib\clang_x64_dll\mswud\build.cfg as the build file to use.

So based on that path, I made my CodeLite Environment variables as follows:

Code: Select all

CodeLiteDir=C:\CodeLite
WXWIN=C:\wxWidgets
WXCFG=build-debug\lib\clang_x64_dll\mswud

That's the part I'm most confused about. Are backslashes okay, or do I have to change them to forward slashes? Is that the right WXCFG? How do you know what the right WXCFG is? As far as I could tell, it's the path to the build.cfg AFTER DELETING the drive and directory in %WXWIN% from the build.cfg path.

I exited CodeLite, added those values to my Windows 10 Environment variables, and reopened CodeLite.

Then I clicked on a very short and simple C-language project and clicked "Clean," and this is what I got back:

Code: Select all

C:/msys64/clang64/bin/mingw32-make.exe -j4 -e -f  Makefile clean
"----------Cleaning project:[ Background - Debug ]----------"
mingw32-make[1]: Entering directory 'G:/v3.9/Background'
rm -f -r ./Debug/
      0 [main] rm (8936) dll_list::form_ntname: WARNING: invalid path name '\??'
    690 [main] rm (8936) C:\CodeLite\rm.exe: *** fatal error - add_item ("\??", "/", ...) failed, errno 22
Stack trace:
Frame        Function    Args
000FFFFCD30  001800629AE (00180294A6A, 0018026FE41, 00800000000, 000FFFF8B30)
000FFFFCD30  0018004846A (00000000000, 000FFFFCD30, 00180020010, 000FFFFABC6)
000FFFFCD30  001800484A2 (000FFFF9BC0, 00000000016, 00800000000, 00000000001)
000FFFFCD30  001800E8D97 (000FFFFCBC0, 00000000000, 001800DBB95, 00000000000)
000FFFFCD30  0018012E3A5 (001800D8024, 00000000000, 00000000000, 00000000000)
000FFFFCD30  00180048AB8 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0  00180047716 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0  001800477C4 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
mingw32-make[1]: *** [Background.mk:111: clean] Error 256
mingw32-make: *** [Makefile:8: clean] Error 2
mingw32-make[1]: Leaving directory 'G:/v3.9/Background'
=== build completed successfully (0 errors, 0 warnings) ===

Despite the "build completed successfully" note, I did not get a dll file resulting from this attempt at a Clean (and since it's just a Clean, I wouldn't expect to).

I gather that rm.exe didn't like a directory name I gave it. But which one? What is rm.exe expecting to see? What is wrong with the directory name? Where did '\??' come from?
How do you debug such a vague error message?

Here is Background.mk, in case it's useful. I copied the contents into a temporary *.txt file because this forum wouldn't let me download a *.mk file.

Background - Copy.txt
You do not have the required permissions to view the files attached to this post.
Post Reply