Building a C++ Visual Studio project in another IDE: fatal error afxwin.h - visual-studio

I downloaded this project's files which is written in visual studio and I am trying to make it compile in Code Blocks. The issue I am having, is with the StdAfx.h/.c files, which if I understand this correctly, are used for Visual studio.
So the error is:
fatal error: afxwin.h: No such file or directory
I get this error inside AtdAfx.h file, because it tried to include it:
#include <afxwin.h> // MFC core and standard components
If I try to delete the AtdAfx.h, my other project's files give me errors, since evey one of them uses the AtdAfx.h.
Side note:
This is the exact error I have Fatal error c1083 "afxwin.h" but he/she uses Visual studio, I use Code::Blocks.

Related

Visual Studio - Build project works without problems but files .dll are missing

When I compile the project everything works fine but when I run it keeps throwing errors saying that .dll files are missing.
Using Visual Studio 17.3.4
CMake configuration
set(OPENSSL_INCLUDE_DIR openssl/install_dir/include)
set(OPENSSL_LIBRARIES openssl/install_dir/lib/libeay32.lib openssl/install_dir/lib/ssleay32.lib)
include_directories(AFTER ${OPENSSL_INCLUDE_DIR})
target_link_libraries(executable_name ${OPENSSL_LIBRARIES})
Error: The code execution can`t continue because libeay32.dll was not found. Reinstalling the program may resolve the issue.

Libjna build - LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

I'm re-posting an issue from github (https://github.com/libffi/libffi/issues/538) I had since last week.
I'm currently having issue getting some JNA libraries built as jar deployables using Ant build script (FYI: https://github.com/thepaul/libjna-java). in order to use the APIs from this library for my other project. (The sole purpose of me going through the hassle building it is to be able to use its API. Due to lack of documentation and absence of existing build artifact provided, I had to do it myself. Importing the whole libjna repo as a project into my other project maybe another approach but I don't think it's appropriate. That said, if there're any better ways to use the libraries in libjna, do let me know!)
So here's what I did trying to build it into deployable jar file:
I already have the source project downloaded.
Tried to compile using Ant (which I downloaded the latest version) on cygwin. Failed because it requires libffi.
So I downloaded libffi source from here (https://github.com/libffi/libffi).
Tried to compile again using Ant. Failed because it couldn't find "/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin/cl" as mentioned in the config.log
So I inspected cc.sh and found that it refers to an older version of Microsoft Visual Studio. I have an existing installation of Visual Studio Express. So I changed the path to "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64" in cc.sh file.
Tried to complile again using Ant. Seemed the fix worked but failed with different error because it couldn't find "mspdbcore.dll". I found this file in "..\x86" so I copy the file across to ..\x64
Tried to compile again using Ant. Failed with similar error but different file because it couldn't find "mspdb140.dll". I found this file in "..\x86" so I copied over
Tried to compile again. Failed with different error because now it says
"LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'"
, although I could confirm this file is definitely in "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64"
To tackle this error I tried (in vain):
adding microsoft visual studio paths to PATH
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE
Downloaded MS Visual Studio 2019 both Community and Professional (couldn't find those dlls for some reason)
Downloaded both mspdb140.dll and mspdbcore.dll separately, config.log says it can't find these files
Note I also did some research online, however:
I don't use visual studio IDE as I"m only trying to build it with Ant, so this post didn't really help much (LINK: fatal error LNK 1104: cannot open file 'LIBCMT.lib')
I don't really understand the answer to this post either (https://social.msdn.microsoft.com/Forums/en-US/cbedc1ba-c50b-499e-aa2e-12b0ce6a40ba/lnk1104-cannot-open-file-libcmtlib?forum=vclanguage)
So this is where I'm stuck.
See latest config log attached.
config.log
Also Ant build log attached.
ant_compile_error.txt
Anyone can help would be much appreciated!
Cheers
Dale

Trying to compile pgAgent. Get an error wx/setup.h: No such file or directory

On one of our servers pgAgent service does not start with the message "ERROR: Couldn't register event handle" (see DBA Question). So I decided to compile the binary from the source, to further investigate the problem.
I installed Visual Studio Community 2017 Edition. I downloaded pgagent source code 3.4.0 and extracted to F:\pgbuild\pgAgent-3.4.0. I downloaded the wxWidgets 2.8, unpacked into F:\pgbuild\wxWidgets and built with visual studio 2017. I pointed out the these variables
wxMSW=F:\pgbuild\wxWidgets
WXWIN=F:\pgbuild\wxWidgets
PGDIR=C:\Program Files\PostgreSQL\9.6
WIX=C:\Program Files (x86)\WiX Toolset v3.11\
Then I tried to compile the pgAgent. Visual studio could recognize the CMake Project of it. When I compile the cmake project, I get an error:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: '../../../lib/vc_lib/mswd/wx/setup.h': No such file or directory F:\pgbuild\pgAgent-3.4.0\CMakeLists.txt F:\pgbuild\wxWidgets\include\msvc\wx\setup.h 123
There are lots of urls around the problem on the net, but I cannot get a handle on it.
It looks to me that this code needs to be updated:
#ifdef wxSUFFIX
#define wxSETUPH_PATH \
wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
#else // suffix is empty
#define wxSETUPH_PATH \
wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
#endif
I built wxWidgets using wx_vc15.sln in F:\pgbuild\wxWidgets\build\msw. I was trying to build pgAgent as CMake project, although the building instructions say that I need to use the GUI version of CMake.
I was following instructions to build pgAdmin, but now I am wondering whether I need to build pgAdmin (don't mix it up vs. pgAgent) at all.
Any suggestions how?
Update:
I installed CMake for Windows and created a solution file to F:/pgbuild/pgAgent-3.4.0/build. Got some errors lines back:
Then clicked on configure, then on gnerate. This created the visual studio project file. Tried to build it, got the error above (wx/setup.h: No such file or directory). The exact error is
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: '../../../lib/vc_dll/mswd/wx/setup.h': No such file or directory pgagent f:\pgbuild\wxwidgets\include\msvc\wx\setup.h 123

Migrating code from VS 2005 to 2013 causes error LNK1104 error?

I'm attempting to migrate a solution file from VS 2005 to VS 2013. The majority of the projects within the solutions rebuilt just fine.
However, some of the projects are coming up with the error:
error LINK1104: cannot open file 'mfc80.lib'
I have searched for mfc80.lib on my computer and it does not exist.
I cannot follow the solution from here fatal error LNK1104: cannot open file 'gdi32.lib' because the file does not exist, therefore I cannot add its path in "Additional Library Directories".
I have:
Deleted all the .obj and .lib files for the problematic project
Ensured Visual C++ MFC MBCS Library for Visual Studio 2013 is installed
Followed Error LNK1104 cannot open file ';.obj'
What else do I need to check?
Thanks.
It appears your project is attempting to include mfc80.lib explicitly. This is the version that VS2005 used; you need mfc120.lib.
Also, double-check that none of your source has a declaration like the following: #define _MFC_FILENAME_VER

Libwbxml compiling on Win32 environment

I've downloaded libwbxml source package from http://sourceforge.net/projects/libwbxml/files/libwbxml/0.11.0/ and followed instructions in the INSTALL file, trying to compile it for Windows environment. However, everytime I build the solution (I'm using VS 2005), I get several error messages like this:
fatal error C1083: Cannot open include file: 'wbxml_config.h': No such file or directory
I've searched throughout the web and could not find a definitive solution for it.
Based on my experience, building on Windows with Visual studio 98 will cause no error.
You may try to build another variant, wbxml2-0.9.2.tar, from sourceforce.net, it only causes error at test phase but the library and 2 tools can be built fine.

Resources