I have these lines inside my code. I have also included the file in my header list inside my project. But when compile I got the below error. What is my mistake?
#ifndef WIN32
# include <netinet/in.h>
# include <arpa/inet.h>
# include <unistd.h>
# include <netdb.h>
# include <sys/socket.h>
# include <sys/un.h>
# include <pwd.h>
# include <grp.h>
#else
# include "getopt.h"
# include <stdarg.h>
# pragma comment (lib, "wpcap.lib")
#endif /* ^WIN32 */
Error 1 fatal error C1083: Cannot open include file: 'getopt.h': No such file or directory c:\filetry.c
getopt is not a visual c header. This might help: http://www.codeguru.com/forum/archive/index.php/t-393293.html
Related
(firstly I'm a chinese, so there might be some syntax errors. I'm sorry for that)
So yesterday I just update my VulkanSDK version to the newest (version 1.3.216.0) as well as VMA, but there's a runtime error occured when I try to run the code which was like : 'Entry Point Not Found'(The picture's chinese)
So I try to clean the Project and Regenerate it but no progress, then I re-installed VulkanSDK and restart my computer but still nothing helped. Later I find that this is a Vulkan error which probably originate from vk_mem_alloc.h (VMA). But I debugged for a few days but still don't understand why "vkGetDeviceImageRequirements" is not find while there seems nothing wrong with "vkGetDeviceBufferMemoryRequirements" which was actually fetched earlier
#if VMA_VULKAN_VERSION >= 1003000
if(m_VulkanApiVersion >= VK_MAKE_VERSION(1, 3, 0))
{
VMA_FETCH_DEVICE_FUNC(vkGetDeviceBufferMemoryRequirements, PFN_vkGetDeviceBufferMemoryRequirements, "vkGetDeviceBufferMemoryRequirements");
VMA_FETCH_DEVICE_FUNC(vkGetDeviceImageMemoryRequirements, PFN_vkGetDeviceImageMemoryRequirements, "vkGetDeviceImageMemoryRequirements");
}
#endif
And here is my base.h:
#pragma once
#include <glad/glad.h>
#define GLFW_INCLUDE_VULKAN
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.hpp>
#include <shaderc/shaderc.hpp>
#include <vma/vk_mem_alloc.h>
This is my CKake list:
cmake_minimum_required(VERSION 3.21)
project(FFEngine_Project)
set(CMAKE_CXX_STANDARD 20)
file(GLOB copyResources "./assets" "./thirdParty/libs/assimp/assimp-vc143-mtd.dll")
file(COPY ${copyResources} DESTINATION ${CMAKE_BINARY_DIR})
include_directories(
SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/thirdParty/include)
include_directories(
SYSTEM D:/Vulkan/VulkanSDK/1.3.216.0/Include)
link_directories(
SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/thirdParty/libs/glfw
SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/thirdParty/libs/assimp
SYSTEM D:/Vulkan/VulkanSDK/1.3.216.0/Lib
)
add_subdirectory(ff)
add_executable(triangle "examples/triangle.cpp")
target_link_libraries(triangle ff_lib glfw3.lib vulkan-1.lib shaderc_sharedd.lib assimp-vc143-mtd.lib)
This error has been confusing me for days, I'm really pissed off... If any more details or codes are needed, ask me, and I'll reply
I have a package hpa that has some functions written in Rcpp. I want to use some of these functions within my new R-package. It is necesseraly to use this functions in "Rcpp form" in order to avoid perfomance penalty so I can't to export them in a usual way.
I have found a similar questions. Following the answer of Dirk Eddelbuettel I have investigated this file and written the following code (within init.c file that has been placed in the src folder) in hope to make polynomialIndex function (from hpa package) become available (in Rcpp i.e. C++ form) for Rcpp functions of other pacakges (including my new one):
#include <Rconfig.h>
#include <Rinternals.h>
#include <R_ext/Rdynload.h>
#include "polynomialIndex.h"
/* definition of functions provided for .Call() */
static const R_CallMethodDef callMethods[] = {
{ "polynomialIndex", (DL_FUNC) &polynomialIndex, 1 },
{ NULL, NULL, 0 }
};
/* functions being called when package is loaded -- used to register */
/* the functions we are exporting here */
void R_init_RApiSerialize(DllInfo *info) {
/* used by external packages linking to internal serialization code from C */
R_RegisterCCallable("hpa", "polynomialIndex",
(DL_FUNC) &polynomialIndex);
R_registerRoutines(info,
NULL, /* slot for .C */
callMethods, /* slot for .Call */
NULL, /* slot for .Fortran */
NULL); /* slot for .External */
R_useDynamicSymbols(info, TRUE); /* controls visibility */
}
Unfortenatelly when I am trying to build hpa package the following error message arise:
/mingw64/bin/gcc -I"C:/R/R-41~1.0/include" -DNDEBUG -I'C:/R/R-4.1.0/library/Rcpp/include' -I'C:/R/R-4.1.0/library/RcppArmadillo/include' -I'C:/R/R-4.1.0/library/RcppParallel/include' -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o
In file included from C:/R/R-4.1.0/library/Rcpp/include/Rcpp/r/headers.h:66,
from C:/R/R-4.1.0/library/Rcpp/include/RcppCommon.h:30,
from C:/R/R-4.1.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26,
from C:/R/R-4.1.0/library/RcppArmadillo/include/RcppArmadillo.h:31,
from polynomialIndex.h:4,
from init.c:4:
C:/R/R-4.1.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:10: fatal error: cmath: No such file or directory
#include <cmath>
^~~~~~~
compilation terminated.
make: *** [C:/R/R-41~1.0/etc/x64/Makeconf:238: init.o] Error 1
It seems to be associated with the fact that polynomialIndex.h file includes <RcppArmadillo.h>. The file itself looks as follows:
#ifndef hpa_polynomialIndex_H
#define hpa_polynomialIndex_H
#include <RcppArmadillo.h>
using namespace Rcpp;
using namespace RcppArmadillo;
NumericMatrix polynomialIndex(NumericVector pol_degrees,
bool is_validation);
String printPolynomial(NumericVector pol_degrees,
NumericVector pol_coefficients,
bool is_validation);
#endif
Then I have tried to remove polynomialIndex.h from init.c and to declare polynomialIndex directly inside init.c file. Unfortunatelly it results into the other error message:
/mingw64/bin/gcc -I"C:/R/R-41~1.0/include" -DNDEBUG -I'C:/R/R-4.1.0/library/Rcpp/include' -I'C:/R/R-4.1.0/library/RcppArmadillo/include' -I'C:/R/R-4.1.0/library/RcppParallel/include' -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o
** using staged installation
** libs
/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o hpa.dll tmp.def ParallelFunctions.o RcppExports.o hpaBinary.o hpaML.o hpaMain.o hpaSelection.o hpaValidation.o init.o normalMoments.o polynomialIndex.o spline.o -LC:/R/R-41~1.0/bin/x64 -lRlapack -LC:/R/R-41~1.0/bin/x64 -lRblas -lgfortran -lm -lquadmath -LC:/R/R-41~1.0/bin/x64 -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.text+0x8): undefined reference to `polynomialIndex'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0x28): undefined reference to `polynomialIndex'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata$.refptr.polynomialIndex[.refptr.polynomialIndex]+0x0): undefined reference to `polynomialIndex'
Please help me to figure out these problems. In the end I want to be able to use polynomialIndex function within my new package. According to the information I have found it should look something like this (simplifed expample):
// [[Rcpp::depends(hpa)]]
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector newFunc(NumericVector pol_degrees,
bool is_validation) {
static SEXP(*polynomialIndex)(Rcpp::NumericVector, bool) = NULL;
polynomialIndex = (SEXP(*)(Rcpp::NumericVector, bool)) R_GetCCallable("hpa", "polynomialIndex");
NumericVector result = polynomialIndex(pol_degrees, is_validation);
return(result);
}
P.S. This question is also similar to this one but does not resolve my problem.
This has been discussed before, and I would urge you to study these other questions and experiment with their answers.
Here you appear to have a cross-over from a C compilation (started by gcc) touching a file in which you crossed over to C++. Which, plainly stated, you cannot do for C compilation.
R offers C interfaces only. Rcpp helps you by autogenerating complying interface files. If you want to extend/alter them you have to play by the rules.
Wrapping C++ code in (simpler, more portable, cross-compiler, ...) C interfaces is a decades old trick. You likely find many resources for it.
Following Dirk Eddelbuettel's suggestion I have made additional search concerning this problem. Unfortunatelly I have found an extremely simple solution.
First, I have deleted init.c file.
Second, I have added the following line of code to all .cpp files of hpa package.
// [[Rcpp::interfaces(r, cpp)]]
Third I have added the following code to the description file of my new package in order to link it to hpa package (I have made it before the solution has been found but in order to provide a full reciepe it seems reasonable to add this information).
Imports: Rcpp (>= 1.0.6), hpa (>= 1.2.1)
Depends: hpa (>= 1.2.1)
LinkingTo: Rcpp, RcppArmadillo, hpa
Fourth, by the same reasons I have added the following line of code to the namespace file:
import(hpa)
Fifth, I have compiled hpa package (as usual) and have found a new folder named inst. Inside this folder there is a folder include. In this folder I have found a new file hpa.h. So I have simply included this file into the code and simplified the call to the function to hpa::polynomialIndex(...). So the resulting (succesfully working!) code is as follows:
// [[Rcpp::depends(hpa)]]
#include <RcppArmadillo.h>
#include <hpa.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector newFunc(NumericVector pol_degrees,
bool is_validation) {
NumericVector result = hpa::polynomialIndex(pol_degrees, is_validation);
return(result);
}
P. S. It was informative to investigate the file hpa\inst\include\hpa_RcppExports.h to understand how does [[Rcpp::interfaces(r, cpp)]] resolves the problem.
I wrote this code to add the splash screen before my installer starts:
[ISSI]
#define ISSI_Splash "C:\ABoffice\Install\InnoSetupProject\Images\client.bmp"
#define ISSI_Splash_T 5
#define ISSI_Splash_X 500
#define ISSI_Splash_Y 220
//#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"
[Setup]
AppName=Client AB OFFICE
AppVersion=5.0
DefaultDirName={sd}\AB_Office\Client
The instruction manual says that I can configure my ISSI installation by setting some presets in the "_issi.cfg" file located in the ISSI folder.
Here's how my "_issi.cfg" file looks like:
[ISSI Configuration]
#define ISSI_IncludePath "C:\ISSI"
;#define ISSI_Constants "YYMDHMS"
;#define ISSI_ConstantsSeperator "."
;#define ISSI_Compression
;#define ISSI_BeveledLabel
[Setup]
OutputDir=C:\Inno Setup Output
But when I compile my script I get this error:
[ISPP] Undeclared identifier: "ISSI_IncludePath".
What do I need to add to my code to be able to read from the _issi.cfg?
You are setting ISSI_IncludePath in the _issi.cfg.
And you then try to include the _issi.cfg into your .iss script by referring to it using the ISSI_IncludePath.
That's a circular dependency.
Maybe you wanted to set the ISSI_IncludePath in your iss file:
#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"
Then you will probably have you remove the #define ISSI_IncludePath from the _issi.cfg.
For a laboration in class we are using an old train simulator for Linux called tsim. I am trying to get this to run on my Windows 10 laptop with Cygwin but I get an error when running the "make" command.
AddToggleWidget.c:3:27: fatal error: X11/Intrinsic.h: No such file or directory
The thing is I think the simulator is so old that it wants to use this X11/Intrinsic.h from an old library called xorg-x11-devel. Because I already have it in a newer one called libXt-devel. This is based on this old cygwin thread.
I have looked everywhere for a way to get the xorg-x11-devel library but can't find it so any help would be greatly appreciated.
The laboration.
The Train Simulator, tsim(source code).
You need to install the libXt-devel package.
To verify if the libXt-devel is properly installed
$ cygcheck -c libXt-devel
Cygwin Package Information
Package Version Status
libXt-devel 1.1.5-1 OK
As it seems that instead your real problem is how to build tsim on cygwin and you are focusing on the wrong issue, I will also provide you the recipe I used.
The following patch is needed for proper build and link:
--- orig/tsim-0.84/src/Makefile.am 2008-09-10 12:45:17.000000000 +0200
+++ tsim-0.84/src/Makefile.am 2016-09-05 22:06:47.665318000 +0200
## -11,5 +11,6 ##
tsim_CFLAGS = -std=gnu99 -pedantic -Wall -Wextra -Wmissing-prototypes \
-DRESDIR=\"${datadir}/tsim\"
-tsim_LDFLAGS = -L/usr/X11R6/lib -lXaw -lXt -lXmu -lX11 -lXext
+tsim_LDFLAGS = -L/usr/lib
+tsim_LDADD = -largp
--- orig/tsim-0.84/src/bitmap.c 2008-09-08 13:14:16.000000000 +0200
+++ tsim-0.84/src/bitmap.c 2016-09-05 22:14:02.032117400 +0200
## -17,14 +17,14 ##
static void GetBitmapPath(
String name,
String full_name) {
- sprintf(full_name, "%s/%s/%s", app_dir(), bitmap_dir(), name);
+ sprintf(full_name, "%s%s/%s", app_dir(), bitmap_dir(), name);
}
void ReadCustomBitmaps(
Widget w) {
char custom_directory[BUFSIZE];
- sprintf(custom_directory, "%s/%s/customBitmaps", app_dir(), bitmap_dir());
+ sprintf(custom_directory, "%s%s/customBitmaps", app_dir(), bitmap_dir());
gBitmapDirectory = BDAddDirectory(w, custom_directory, NULL);
}
--- orig/tsim-0.84/src/pipe.c 2008-09-09 12:55:58.000000000 +0200
+++ tsim-0.84/src/pipe.c 2016-09-05 18:47:40.261754300 +0200
## -3,6 +3,7 ##
#include <stdlib.h> /* exit */
#include <unistd.h> /* read */
#include <sys/param.h> /* MIN, MAX */
+#include <sys/socket.h>
#if defined sun3 || defined sun4
#include <sys/filio.h>
Makefile.am is changed as /usr/X11R6/lib has been replace long time ago by /usr/lib and the libs should be put in LDADD not on LDFLAGS to avoid problem of order durink linking . -largp is missing from the requirement while the the other libs will be correctly added during configure
The changes in bitmap.c are needed to avoid wrongly loading default data. Cygwin have a dedicate meaning for path starting with "//" that are a side effect of current code.
Step by step instruction:
- install libargp-devel, libX11-devel, libXaw-devel, libXext-devel, libXmu-devel, libXt-devel
- unpack the tsim-0.84.tar.gz
- apply the patch
- run autoreconf , it will properly rebuilds the Makefile.in
- run ./configure it will properly rebuilds the Makefile
- run make
- run make install
- run tsim
As bonus, how the program looks:
I have two WIN32 DLL projects in the solution, main.dll should call a function in mgn.dll.
mgn.dll has mgn.h header file:
#ifdef MGN_EXPORTS
#define MGN_API __declspec(dllexport)
#else
#define MGN_API __declspec(dllimport)
#endif
extern "C" bool MGN_API AttachMGN(void);
and mgn.cpp source file:
#include "stdafx.h"
#include "mgn.h"
MGN_API bool AttachMGN(void)
{
...
}
main.dll calls AttachMGN function from one of the source file:
#include "stdafx.h"
#include "..\mgn\mgn.h"
bool CreateClient()
{
return ::AttachMGN();
}
mgn.dll compiles successfully. main.dll doesn't show any errors in VS text editor, I can navigate using "Go To Definition" function. However during build I get the error:
error LNK2019: unresolved external symbol __imp__AttachMGN referenced in function "bool __cdecl CreateClient(void)" (?CreateClient##AW4XZ)
Both DLLs compile into the same folder. DependencyWalker shows the function AttachMGN as exported. Main project has a dependency set to Mgn project, if that matters.
I believe that I simply have overlooked something....
Thanks in advance.
You probably just forgot to add MGN.lib to your link arguments for main.dll
Is your mgn.lib linked with the main? By the sound of it, it looks as if main cannot find the lib file to link against the DLL.