File wx/wx.h does not exist - c++

I've been trying for a while now to compile and use wxwidgets for a c++ project, but every time I think I get close, the same error occurs. File wx/wx.h does not exist. I've tried building wxwidgets with cygwin and VS2019, just downloading the binaries, and finally(what I've most recently tried), downloading the library using the vcpkg package manager. I made an environment variable to the include folder within wxwidgets(C:\vcpkg\packages\wxwidgets_x86-windows\include), and I included wx.h by typing
#ifndef WX_PRECOMP
#include "wx\wx.h"
#endif
For clarification, I'm on windows 10 and I'm using clang++. Any help would be greatly appreciated, since I've had this problem for a while now and I couldn't find any answers.

You can build or get and use wxWidgets in many different ways, all of which work, but you can't mix different ways together and expect them to work.
If you want to use vcpkg, you should follow the instructions here and you can read this post for more details.

Building with MSVC is very straightforward.
Open MSVC environment.
Navigate to the wxWidgets\build\msw and open wx_vcN.sln (for 2019 version N should be 16).
Select "Build -> Batch Build...", Click "Select ALL", then "Build".
Go drink a cup of coffee. ;-)
Open the file wxWidgets\samples\minimal\minima_vcN.sln (use maximum N available, let MSVC convert the solution if needed).
Select "Build -> Build Solution".
Open the Windows Explorer, navigate to the folder wxWidgets\samples\minimal, find the miinimal.exe binary and double click on it.
In order to build your own code:
You can either copy the folder of the miinimal sample somewhere, open it back up from new location and adjust Include and Library paths as appropriate (old way) or use the properties file supplied with the newest release of wxWidgets (create an empty Win32 project and then copy this file as appropriate) - there is an instruction on either MS web site or in the wxWidgets documentation.
If you have any problems with any of the steps - let us know.
Thank you.

Related

How do I turn my C++ code into a .app file? [duplicate]

I am building a C++ OpenGL card game in Xcode 4.3.3, with the intention of running it on both 64-bit and 32-bit Macs, which is not my problem. My problem is that I have reached a point in the development of the program where I would like to test that it works on a different 32-bit Mac (mine is 64-bit) without having to install Xcode. This, obviously, requires me exporting it as an .app. I can find and run the exported Unix Executable File from my project, after some cd'ing, through Terminal, but that is undesirable for me and the intended audience of the program. I have trawled the google and Stack Overflow, looking for anything to help me, but all the things mentioning Archiving seem to have been unsuccessful with my particular project, and I think that's because it's a C++ command line tool project. So, can someone please help me export my project as a .app?
Thanks in advance.
The simplest way of doing this would be to create a Cocoa project, go to 'build phases' and remove all the objective-c frameworks from the 'link with libraries' build phase, remove any objective-c files added by the template (app delegate, etc.) and then replace main.c with your main.cpp file.
There's nothing really special about a Cocoa project except for the fact that it links against Cocoa and calls NSApplicationMain() from its main() function.
There are also a bunch of .plist entries used by Cocoa which you'll no longer need. But they won't affect the way OS X treats your application.
I'm searching for an XCode Settings solution but here's my current way to create an app:
You have to take your binary file (let say myapp) and put it in "MyApp.app/Contents/MacOS/myapp" then it can now be launched as a .app. That's a trick.
Just go to the targets folder in the file navigator on the left, and there will be an executable listed there. Left click on that executable and click "show in finder". (I'm describing from memory so I may have the exact details wrong.) The file path is ridiculously long (there is an arbitrary alphanumerical pathname involved, I have no idea why), so you probably won't be able to find it with the command line.
If you want you can change the extension of the file from nothing to ".app", it shouldn't affect the nature of the file at all. Also if you want a custom icon, you can "get info" on it in the finder, then click on the icon in the info window, and use Cmd-V to paste it in (obviously you have to have your icon copied to the clipboard). There is also a way to do this inside of Xcode, but I don't remember it.

How to set up wxWidgets 3.1.0 with Visual Studio 2015

I am somewhat of a beginner when it comes to open source libraries. I have tried to compile from source and use the pre-built binaries, but in both cases I get a ton of errors when I try to run the simple 'Hello World' program on the tutorial section of the wxWidgets website. After playing around for quite some time, the closest I have got to compiling is by building the libraries from source, but I still have 2 errors remaining:
"_w64 can only be specified on int, long, and pointer types" file: defs.h
"cannot open file 'wxbase31ud.lib" - LINK
It seems strange to me that the header file provided by wx would have an error such as that one, so I imagine both errors are because of something I am doing. I am hoping that someone here can do one of the following for me:
Help me solve these errors
Provide instructions for building libraries from source and subsequently linking my program to the correct directories
Some additional info: I am working on x64 Windows 7, my target will also be x64 exclusively. I do not have admin privileges, so no editing the system PATH for me.
Thanks for your help!
The simplest way to start working with the library is this:
Grab the sources.
Unpack the sources.
Open VS IDE.
Open \build\msw\wx-vc14.sln (adjust as necessary.)
Go to "Build->Batch Build...", click "Select All", "Build".
Go drink some coffee or watch TV.
After the build finishes, open wxWidgets/samples/minimal/minimal_vc9.sln.
Let MSVC convert the solution to become an appropriate format.
Build and run the sample.
If you will acquire any issue during those steps, let us know.
The library build in step 5 should build without any issues and then all you will need is to build the minimal sample.
The next step is to copy the samples\minimal folder somewhere and start writing the code. All you will need to do is to change the Include and Lib search path.
[EDIT]
If you can build the 32-bit libraries (which are default in the provided solutions) all you will need is to convert them to be 64-bit and rebuild.
There is no changes to the $PATH or any environmental variable involved. Moreover you shouldn't build anything with the admin priviledges.
Also as Thomas pointed out you library build has to match whatever sample you are trying to build.
[/EDIT]

C++ parsing a text file that is located online

Information about what I want to do:
-read in a few integer variables from a text file that will be located on a dropbox public folder.
-the variables will be used to trigger some if statements thus controlling my application remotely if I need to have it do something ( I would just save the variable I need to that text file and my program with would read from it every 5 seconds would see it and perform the required actions).
-this is a console application which is being built and compiled in visual studio 2010 on windows 7. The software will also be running on a win7 computer.
I need help with:
I already have read on using a library called libcurl. The problem is that I do not know how to link this library with my project in vs2010. Detailed instructions on how to do this on vs 2010 would be very helpful.
OR
if you can think of a better and easier way to accomplish what I need done, offer some advice and direction
It sounds like you're a novice, is that correct? If not then apologies for stating the obvious.
To use your compiled DLL in your application you need to 'add a reference' to it. You can do this by adding what is called a binary reference, where you simply tell visual studio where to find the dll. Or you can add a project reference if the project which is producing the dll is within the same solution. The best approach is to use something called nuget. It's a visual studio extension which automates the adding of binary references available from a public repository.
I have just done a search for libcurl on nuget.org and drew a blank. As I am unfamiliar with this library you may have better luck finding a nuget package as you will be a le to search using better terms that I did (curl and libcurl)
Whatever approach you take, just right-click on the project in which you want to use libcurl within the solution explorer and you should find an add reference option in the menu.

LEDA library installation

I have downloaded LEDA free edition from this website
http://www.algorithmic-solutions.com/leda/ledak/index.htm
First quetion:
I want to use this library with my project in VS2010 ide, but i didn't really catch from installation notes, how can i install this library on windows platform.
There were already some static libs (you can see them on the image), which i added to my project with appropriate headers. But that, i suggest, is not a right way. So i will be glad if you will briefly describe the steps, which i should make to compile this library...
The root library directory looks like this
Second question:
In leda's installation guide i can see two main sections:
1.) CONFIGURATION/INSTALLATION FOR UNIX
2.) CONFIGURATION/INSTALLATION for MS Visual C++
In "CONFIGURATION/INSTALLATION for MS Visual C++" i can see the following:
Go to the LEDA main directory (at the command prompt used above).
Type: lconfig msc [dll] [ ml | mld | md | mdd | mt | mtd ]
I'am sorry, i have never seriously used UNIX based systems, but i always thought that MS Visual C++ is a thing, strongly connected with Windows, and lconfig is a unix command?
So i confused, this guide is for unix or for windows or ...?
Thank you, sorry for possibly stupid questions.
The LEDA "free" edition does not include source code. They sell the source code for users who want to modify / compile it. What you have downloaded can be used by including the .h in \incl and linking against the appropriate .lib files. It appears that the package gives you several .lib files to cover all the options of static linking or dynamic linking.
The lconfig instructions are for when you do have the source code, and you want to control which configuration of dll/lib gets built.
"lconfig" is not a standard or even niche UNIX tool; a quick google suggests it's something that actually comes with LEDA itself. Since you've downloaded it, you ought to see it someplace in the bundle.

C++ Logging Library Setup

I've been trying for about 2 weeks now to get a logging library to work with. I've tried Log4cxx, Log4cpp, log4cplus and boost.log. The problem isn't that none of these work for me, it's that I can't figure out how to get them to work at all. I would really like to use log4cxx since I'm working with log4j/logback at work, but I haven't been able to get any of the libraries based on log4j to build. I've been able to build and use the boost library, but boost.log gives me all kinds of linker errors no matter what I try. If anyone could direct me to a step-by-step guide to get one of these libraries working I would greatly appreciate it. Also, I'm using eclipse as my IDE if that matters.
Did you ever get this working? Log4cxx definitely works on Win7. Maybe you could post some of your build errors. Just guessing, perhaps you didn't configure your eclipse project to link with a log4cxx static lib.
Boost.Log works for me quite well (Linux and Windows). It is not a header only library, there is a compiled part that you need to link against. See instructions here.
It also depends on other, non-header, Boost libraries:
The logging library uses several other Boost libraries that need
building too. These are Boost.Filesystem, Boost.System,
Boost.DateTime, Boost.Thread and Boost.Regex. Refer to their
documentation for detailed instructions on the building procedure.
Depending on your platform there may be pre-built versions of the Boost libraries. Otherwise building it yourself is straightforward if you follow the instructions. If you get stuck update your question with where exactly you got stuck and what you're seeing.
I'd recommend Pantheios. It takes some time to build everything when you first download - type make build test and go have lunch - and you have to select the output streams (Pantheios calls them "back ends") at link time, but for coding, it is really simple, e.g.
std::string name;
int age;
pantheios::log_DEBUG("name=", name, " age=", pantheios::integer(age));
It's designed from the ground up for speed - the age won't be converted into a string unless the "DEBUG" level is switched on - and robustness - which is why you can't pass fundamental types directly, and use "inserters" (e.g. pantheios::integer). See this recent blog post by Pantheios' author for more information.
I managed to get log4cxx to work, this was done in Visual Studios 2013 running on Windows 7 OS.
This following is what I did, step by step:
Download the log4cxx ZIP package extract its contents, http://logging.apache.org/log4cxx/download.html
Download apr and apr-util ZIP packages, http://apr.apache.org/download.cgi
Then
manually extract this zip apr-1.2.11-win32-src.zip (the
extracted folder should be named 'apr', if it is not manually rename
it)
manually extract this zip apr-util-1.2.10-win32-src.zip (the
extracted folder should be named 'apr-util', if it is not manually
rename it)
open a command prompt and run the following: cd
apache-log4cxx-0.10.0 configure (this
will execute configure.bat)
We will need to disable to use of the APR ICONV and LDAP support.
In order to do so, we will append the following files manually:
Open apr-util\include\apu.hw. Find the line starting with “#define
APU_HAVE_APR_ICONV”. Change the value to 0 and save.
Open apr-util\include\apr_ldap.hw. Find the line starting with
“#define APR_HAS_LDAP” Change the value to 0 and save.
We need to build the log4cxx.dll, to do so convert *.dsw
to *.cxproj.
Launch Visual Studio 2013 and open log4cxx.dsw.
VS will ask if you like to convert everything. Simply click Yes.
There may be some warnings in the migration report, but nothing that
should prevent the solution from opening.
> The projects xml, apr, and apr-util should build successfully.
If you try compiling the log4cxx project it will most
likely fail with hundreds of errors. This is due to a bug in VC++
which can be worked around.
Move all macros outside (above) the class they are in.
LOG4CXX_LIST_DEF macro is used to define classes. All macros reported in error C2252 will need to move out of any classes. This
may also include moving definitions which are used in the macro.
Next, change all LoggingEvent::KeySet to KeySet (this is no longer nested in a parent class)
> Following this, the log4cxx project should now compile
successfully on your machine.