setup.h is in my includes but not found.

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

setup.h is in my includes but not found.

Post by chemdream »

On MacOs,

I've downloaded the latest WxWidgets, sucessfully compiled it via the command line, and run the minimal.app.
That is all without opening VS Code or anything.


However, in the minimal.cpp in VS Code, I get:

Code: Select all

cannot open source file "../../../lib/vc_lib/msw/wx/setup.h" (dependency of "wx/wxprec.h")
That folder doesn't make sense to me.

In my IntelliSense includes I have:

Code: Select all

${workspaceFolder}/**
/Users/me/Local/src/wxWidgets-3.2.1/include/**

setup.h DOES exist in:

Code: Select all

/Users/me/Local/src/wxWidgets-3.2.1/include/msvc/wx
And adding that specific path doesn't help either.

When I try a simple hello word
https://docs.wxwidgets.org/3.0/overview_helloworld.html
I get:

Code: Select all

wxprec.h file not found. gcc
Which seems crazy because:
-It literally auto completes in VS Code
-With the same includes, I get a complete different error in the sample/minimal ...

I feel like I'm taking crazy pills...
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
Did you build the library on WIndows?

It looks like you build it on Mac, but not on Windows...

Does the following folder exist:

/Users/me/Local/src/wxWidgets-3.2.1/lib

?

Which compiler do you use?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: setup.h is in my includes but not found.

Post by doublemax »

I don't know anything about how to setup VS Code for wxWidgets, but maybe this helps.
cannot open source file "../../../lib/vc_lib/msw/wx/setup.h" (dependency of "wx/wxprec.h")
The "msw" means that it's looking for the Windows headers, which is wrong here.
I've downloaded the latest WxWidgets, sucessfully compiled it via the command line, and run the minimal.app.
Check the command line used here, it should contain the correct include paths.
Use the source, Luke!
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

Thanks for all the responses.

I'll answer all those questions once I get back on that computer.

However, I'm trying this (almost) same thing on a linux computer with VS Code.

Specifically, I'm trying this: https://github.com/huckor/wxwidgets-vscode

Everything works fine in command line, but VS code is complaining about setup.h still missing.
So it must be something about VS Code I'm not understanding. I've used VS code for many other languages but I'm new to CPP.
(I realize there are Python etc options for Wx, but would like to do CPP)
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
You don't need any of this.
Remove that repository completely.

Start a new project.
Open project properties.
Set proper include and lib folders and also the libraries to link with.
(if you are on *nix - open a Terminal and run:

Code: Select all

wx-config --cxxflags
wx-config --libs
to find what to put there).

Compile and run.

Thank you.

If you are new with C++ you need to learn the language first, and then try to work with the advanced library as wxWidgets.
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

So far, nothing I've tried has worked.

I even have a Stack Overflow question: https://stackoverflow.com/questions/73 ... 2_73938456

Again, Wx is installed correctly and works correctly. Everything compiles correctly.

It's something in VSCode that's wrong. The problem is that when I ask MS VS Code communities about it, the most common response is "Oh, I remember Wx from back in the day, people still use that?!" :roll:
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
Yes, people are using it and not just people. US Government is.

I did see your posting on the guru.com and I gave you some suggestions.

Let me know if I can help more.

Thank you.

BTW, you should've asked about mixing Windows and *nix/Mac settings in the project - not abouyt wx stuff. ;-)
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

I got a bit further on this!

It was a syntax error in InteliSense.

So now I'm using this exact example: https://wiki.wxwidgets.org/Hello_World

HelloWorldApp.cpp has 0 errors!

However HelloWorldApp.h has 2 errors.

Code: Select all

#ifndef INCLUDED_HELLOWORLDAPP_H
#define INCLUDED_HELLOWORLDAPP_H

// The HelloWorldApp class. This class shows a window
// containing a statusbar with the text "Hello World"
class HelloWorldApp : public wxApp //error here is: not a class or struct name
{
public:
	virtual bool OnInit();
};

DECLARE_APP(HelloWorldApp) //2x errors here: "explicit type is missing ('int' assumed)" and "expected a ';'" ... I tried changing this to bool DECLARE_APP(HelloWorldApp); but that didn't seem to help.

#endif // INCLUDED_HELLOWORLDAPP_H
So the .cpp sees the libs fine but .h is confused?
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

Switching VS Code to C++ 23 standard gets rid of the .h errors!

But brings back the "'wx/wxprec.h' file not found" error in the .cpp

Hah. I guess that's closer?
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
One stupid question - can compile the program and then run it?
Meaning is it only the Intellisense issue or you have an error in compilation/linking?

Thank you.
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

Not a stupid question.

WxWidgets is installed perfectly fine.

From command line, it compiles perfect.

In VS Code, if you hit run/debug, it finds errors but asks if you want to continue. if you do, it compiles fine.

The problem I'm trying to solve is for VS Code to work as a proper IDE for Wx in Mac and Linux. Meaning, no false errors and proper autocompleting.

It worked perfect with WxGo.

I'm trying not to use a different IDE, just because I use VS Code for all my other languages/frameworks.

Thanks!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
Understood.
Getting Intellisense to work is the task on its own. ;-)

And I am not sure if the presence of msw port is what prevents it from working.

Did you try to search for "msw" in the project folder as I suggested in the SO?

Thank you.
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

There is no msw folder. I did grep for it. I think that's VS's issue. For some reason, it wants one. But there shouldn't be one because I'm in macOs?

I did reply to you on Guru. If you get a moment, send me a quote on it? :-)
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: setup.h is in my includes but not found.

Post by ONEEYEMAN »

Hi,
We are not looking for msw folder. What I want you to do is:

Open a Terminal.
Go where you proect file and source files are.
Issue "grep -riI msw *"

What is the output?

Its also possible VSCode didn't guess the OS correctly That's why I said to try and re-install it (possibly even to try to do that in the VM)

Thank you.
chemdream
Experienced Solver
Experienced Solver
Posts: 61
Joined: Sat Sep 24, 2022 9:07 pm

Re: setup.h is in my includes but not found.

Post by chemdream »

I may not know Intelisense very well. But I do know grep :-)
There is no msw folder.

wx/include/osx_cocoa-unicode-3.2/wx/setup.h:#ifdef __WXMSW__
wx/include/osx_cocoa-unicode-3.2/wx/setup.h:#ifdef __WXMSW__
wx/include/osx_cocoa-unicode-3.2/wx/setup.h:#ifdef __WXMSW__
wx/include/osx_cocoa-unicode-3.2/wx/setup.h:/* --- start MSW options --- */
wx/include/osx_cocoa-unicode-3.2/wx/setup.h:#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
wx/include/osx_cocoa-unicode-3.2/wx/setup.h:/* --- end MSW options --- */

This problem is happening on multiple computers. 2x linux laptops and 1x MacOS laptop. I don't think there'd be a VScode issue on 3 machines?
Also, VS Code is working perfect for all other languages.
Post Reply