小编use*_*898的帖子

在c ++应用程序中嵌入php或以任何方式可以完成?

我一直在寻找将php脚本嵌入到c ++ windows应用程序中的方法.我发现旧的Facebook项目,我不知道它是多么好或如何在Windows应用程序中使用它,如果有的话.有没有办法在Windows应用程序中嵌入php?

php c++

3
推荐指数
1
解决办法
4028
查看次数

fopen fprintf dosnt只有在关闭后才能写入文件

如何启用写入文件befor关闭它,我有这个代码写入文件,是这样做,但只有在我关闭应用程序后,它才能让干扰器成为简单记录器的一部分.我需要的是看到写更新(使用tail -f)

void init(char *pfileName)
    {
        if(pfileName != NULL)
        {
            fp = fopen(pfileName, "a+");
            if(fp != NULL)
                fseek(fp, 0, SEEK_END);
        }
    }

    void close()
    {
        if(fp != NULL)
            fclose(fp);
        fp = NULL;
    }

void write(char *pType, std::string pMsg, char *pFileName, int lineNo)
    {
        if(fp != NULL)
        {
            fprintf(fp,"%s %s %s %s %d %s\n", pType, __DATE__, __TIME__, pFileName, lineNo, pMsg.c_str());

        }
    }
Run Code Online (Sandbox Code Playgroud)

c fopen fwrite

3
推荐指数
2
解决办法
4192
查看次数

Qt鼠标光标重置

我有项委托,当鼠标事件结束时,我将其光标更改为Qt :: PointingHandCursor,当它关闭时我将其设置回Qt :: ArrowCursor.它的工作正常.
问题是,除了它超过图标.它总是叠加在Qt :: ArrowCursor上,即使在图标需要本地更改的情况下,例如调整窗口大小或超过本机按钮时.它总是Qt :: ArrowCursor.
当它没有超过图标时,我怎么能强制Cursor正常行动呢?
这是我做的:

bool MiniItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model,
                                         const QStyleOptionViewItem &option,
                                         const QModelIndex &index)
    {
        // Emit a signal when the icon is clicked
        QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
        if(!index.parent().isValid() &&
                event->type() == QEvent::MouseMove) 
        {

             QSize  iconsize = m_iconAdd.actualSize(option.decorationSize); 
             QRect closeButtonRect =  m_iconAdd.pixmap(iconsize.width(),iconsize.height()).
                                                        rect().translated(AddIconPos(option));

             QSize iconRemoveSize = m_iconRemove.actualSize(option.decorationSize);
             QRect iconRemoveRect =  m_iconRemove.pixmap(iconRemoveSize.width(),iconRemoveSize.height()).
                                                                rect().translated(RemoveIconPos(option));

             if(closeButtonRect.contains(mouseEvent->pos()))
             {                
                QApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor)); 
             }
             else if(iconRemoveRect.contains(mouseEvent->pos()))
             {
                QApplication::setOverrideCursor(QCursor(Qt::PointingHandCursor)); 
             }
             else
             {
                 Qt::CursorShape shape = Qt::ArrowCursor;
                 QApplication::setOverrideCursor(QCursor(shape)); 
             }
        }

        if(!index.parent().isValid() …
Run Code Online (Sandbox Code Playgroud)

c++ mouse qt

3
推荐指数
1
解决办法
3943
查看次数

在c ++无类变量中避免"已定义在...中"错误/交战

我有我在Utility命名空间中定义的全局变量.该实用程序包含在多个文件中,如下所示:

#ifndef _UT_
#define _UT_
namespace UT {
  std::string PLATFORM_LINUX_NAME = "linux";
  std::string  PLATFORM_MACOSX_NAME = "macosx";
  std::string  PLATFORM_WINDOWS_NAME = "windows";
  #if defined(OS_WIN)
    int PLATFORM = OSTYPE::PLATFORM_WINDOWS;
  #elif defined(OS_LINUX)
    int PLATFORM = PLATFORM_LINUX;
  #elif defined(OS_APPLE)
    int PLATFORM = PLATFORM_MACOSX;
  #endif
};
Run Code Online (Sandbox Code Playgroud)

当我将此文件包含在例如文件Ah和Bh和Ch中时,我收到的编译器警告说:

warning LNK4006: "int UT::PLATFORM" (?PLATFORM@UT@@3HA) already defined in A.obj; second definition ignored
warning LNK4006: "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > UT::PLATFORM_LINUX_NAME" (?PLATFORM_LINUX_NAME@UT@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) already defined in A.obj; second definition ignored
Run Code Online (Sandbox Code Playgroud)

什么是不涉及创建一个类来解决这个问题的最佳方法?或者是创建UT类的唯一方法?

c++ warnings

3
推荐指数
1
解决办法
5706
查看次数

std :: vector <A>错误C2582:'operator ='函数不可用

我使用简单的向量push_back到类型A的对象并得到此错误,这是我的代码:

class A 
{
    public:
    A(int a,int b,int c);
};


#include "A.h"
....
....
....
....
std::vector<A>* vec_objects = new std::vector<A>();

while(....some condition ...) 
{

    A a(1,2,3)
    vec_objects->push_back(a);
}
Run Code Online (Sandbox Code Playgroud)

收到此错误:

c:\program files\microsoft visual studio 9.0\vc\include\xutility(3159) : error C2582: 'operator =' function is unavailable in 'A'
1>        c:\program files\microsoft visual studio 9.0\vc\include\xutility(3187) : see reference to function template instantiation 'void std::_Fill<A*,_Ty>(_FwdIt,_FwdIt,const _Ty &)' being compiled
1>        with
1>        [
1>            _Ty=A,
1>            _FwdIt=A *
1>        ]
1>        c:\program files\microsoft visual studio …
Run Code Online (Sandbox Code Playgroud)

c++ stdvector

3
推荐指数
2
解决办法
7934
查看次数

qVariantValue是"QT_DEPRECATED" - 替换是什么?

我需要将Qt遗留代码从4转换为5.1现在我在visual studio 2010中有编译错误:

SingleItem* item = qVariantValue<SingleItem*>(index.data());  
Run Code Online (Sandbox Code Playgroud)

给我 :

.cpp(63):错误C2065:'qVariantValue':未声明的标识符

当我去标题时,我看到:

#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qVariantValue(const QVariant &variant)
{ return qvariant_cast<T>(variant); }

template<typename T>
inline QT_DEPRECATED bool qVariantCanConvert(const QVariant &variant)
{ return variant.template canConvert<T>(); }
#endif
Run Code Online (Sandbox Code Playgroud)

好的...那么更换什么?

c++ qt qvariant

3
推荐指数
1
解决办法
2247
查看次数

使用c ++从mp4中提取音频到mp3(不用args执行ffmpeg)

我如何以编程方式转换(提取音频通道)从mp4视频文件格式?
因为使用c ++,我在网上找不到任何东西.
我动态链接外部引擎,我可以通过c ++获取mp4文件并将其转换为mp3文件.
并且不将命令行参数传递给LAME或MPLAYER或FFMPEG?

c++ mp3 mp4 converter

3
推荐指数
1
解决办法
4258
查看次数

Visual Studio 2008 错误 C2371:'int8_t':重新定义;不同的基本类型(http_parser.h)

我尝试编译使用 node.js 中的 http_parser 的简单 c/c++ 应用程序,我也使用 libuv ,并且基本上尝试在 Windows 中编译此示例。使用 Visual Studio 2008

但我收到此编译错误:

>d:\dev\cpp\servers\libuv\libuv_http_server\http_parser.h(35) : error C2371: 'int8_t' : redefinition; different basic types
1>        d:\dev\cpp\servers\libuv\libuv-master\libuv-master\include\uv-private\stdint-msvc2008.h(82) : see declaration of 'int8_t'
Run Code Online (Sandbox Code Playgroud)

http_parser.h 文件中的代码如下所示:

#include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
#include <BaseTsd.h>
#include <stddef.h>
//#undef __int8
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t; …
Run Code Online (Sandbox Code Playgroud)

compiler-errors visual-c++

3
推荐指数
1
解决办法
1万
查看次数

使用intellij的maven错误正在引用自身

我有这 2 个简单的 pom.xml 主要父项目和模块,该项目正在使用主项目 pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



    <modelVersion>4.0.0</modelVersion>

    <groupId>com.clouddispatcher</groupId>
    <artifactId>clouddispatcher</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>aws-manager</module>
    </modules>
    <dependencies>
        <dependency>
            <groupId>com.clouddispatcher</groupId>
            <artifactId>aws-manager</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <properties>
        <aws.java.sdk.version>1.11.875</aws.java.sdk.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk</artifactId>
                <version>${aws.java.sdk.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>
Run Code Online (Sandbox Code Playgroud)

和模块 pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>clouddispatcher</artifactId>
        <groupId>com.clouddispatcher</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>aws-manager</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk</artifactId>
        </dependency>
    </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

现在当我跑步时: …

java intellij-idea maven

3
推荐指数
1
解决办法
8533
查看次数

如何将 Vault CLI 连接到 k8s 上安装的 Vault 集群?

我已在 k8s (AKS) 中安装了 Vault 集群,现在我尝试使用 Vault CLI 连接到该集群,
问题是我找不到任何信息或文档。
我下载了Vault.exe,但是在哪里配置它以连接到集群?

hashicorp-vault

3
推荐指数
1
解决办法
8982
查看次数