小编cri*_*ian的帖子

无法编译项目:locale.h文件中的错误

我正在尝试编译一个具有以下标题的项目:locale.h;

locale.h文件:

class LOG4CXX_EXPORT Locale
{
public:
       ...

protected:
    Locale(const Locale&);
    Locale& operator=(const Locale&);
    const LogString language; <-- error
    const LogString country;  <-- error
    const LogString variant;  <-- error
}; // class Locale
Run Code Online (Sandbox Code Playgroud)

有人能给我一些建议吗?

我收到了这个错误.我不确定是什么问题.

/LOGGER/include/log4cxx/helpers/locale.h:42:41: error: field ‘language’ has incomplete type
                     const LogString language;
                                     ^
/LOGGER/include/log4cxx/helpers/locale.h:43:41: error: field ‘country’ has incomplete type
                     const LogString country;
                                     ^
/LOGGER/include/log4cxx/helpers/locale.h:44:41: error: field ‘variant’ has incomplete type
Run Code Online (Sandbox Code Playgroud)

c++ header c-preprocessor

6
推荐指数
1
解决办法
703
查看次数

vitualenv 不适用于我的 2.7.9 python 安装

安装后:

pip install virtualenv
Run Code Online (Sandbox Code Playgroud)

运行它会大喊:

    C:\programs\python\Python27\Scripts>virtualenv.exe
    Traceback (most recent call last):
      File "C:\programs\python\Python27\lib\runpy.py", line 162, in _run_module_as_main
        "__main__", fname, loader, pkg_name)
      File "C:\programs\python\Python27\lib\runpy.py", line 72, in _run_code
        exec code in run_globals
      File "C:\programs\python\Python27\Scripts\virtualenv.exe\__main__.py", line 5, in <module>
      File "C:\programs\python\Python27\lib\site-packages\virtualenv\__init__.py", line 3, in <module>
        from .run import cli_run, session_via_cli
      File "C:\programs\python\Python27\lib\site-packages\virtualenv\run\__init__.py", line 7, in <module>
        from ..app_data import make_app_data
      File "C:\programs\python\Python27\lib\site-packages\virtualenv\app_data\__init__.py", line 9, in <module>
        from platformdirs import user_data_dir
    ImportError: No module named platformdirs

Run Code Online (Sandbox Code Playgroud)

有什么想法为什么会发生这种情况吗?点 1.5.6

python installation pip python-2.x virtualenv

6
推荐指数
0
解决办法
1672
查看次数

这是使用访问功能的好习惯

我有以下代码,我想在使用GCC 4.8的Linux上工作

这与VS 2013一起使用

if ( _access( trigger->c_str(), 0 ) != -1 ) 
{
   ...
}
Run Code Online (Sandbox Code Playgroud)

我知道在Linux上我可以使用函数:从"unistd.h"访问

有没有办法避免像下面这样的东西(更优雅的解决方案)?

#ifdef __linux__ 
    #include <unistd.h>
#endif

#ifdef __linux__ 
     if ( access( trigger->c_str(), 0 ) != -1 ) 
     {
          ...
     }
#else
     if ( _access( trigger->c_str(), 0 ) != -1 )
     {
          ...
     }
#endif
Run Code Online (Sandbox Code Playgroud)

c++ gcc visual-studio

4
推荐指数
1
解决办法
1647
查看次数

不能在C++中使用宏

我正在尝试使用GNU在Linux上的Eclipse CDT中构建以下代码:

log_defs.h

#pragma once

#define dbg_log(fmt, ...) debug_logger::debug(__FILE__, __FUNCTION__, __LINE__, fmt, __VA_ARGS__, 0)
Run Code Online (Sandbox Code Playgroud)

ErrorMessage.cpp

ErrorMessage::ErrorMessage( void ){ dbg_log( L"ErrorMessage::ErrorMessage _in" ); }

ErrorMessage::~ErrorMessage( void ){ dbg_log( L"ErrorMessage::~ErrorMessage _in" ); }
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

../sources/ErrorMessage.cpp: In constructor ‘ErrorMessage::ErrorMessage()’:
/include/log_defs.h:27:97: error: expected primary-expression before ‘,’ token
 #define dbg_log(fmt, ...) debug_logger::debug(__FILE__, __FUNCTION__, __LINE__, fmt, __VA_ARGS__, 0)
                                                                                             ^
../sources/ErrorMessage.cpp:150:37: note: in expansion of macro ‘dbg_log’
 ErrorMessage::ErrorMessage( void ){ dbg_log( L"ErrorMessage::ErrorMessage _in" ); }
                                 ^
../sources/ErrorMessage.cpp: In destructor ‘ErrorMessage::~ErrorMessage()’:
/include/log_defs.h:27:97: error: expected primary-expression before ‘,’ token …
Run Code Online (Sandbox Code Playgroud)

c++ eclipse gnu c-preprocessor

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

无法在 Eclipse CDT 中指定多个 rpath

我想在 GCC C++ Linker 的 Miscellaneous 部分指定多个 rpath。

链接器标志:

-Wl,-rpath=/home/cri/Libs1, -Wl,-rpath=/home/cri/Libs2

对于一个它正在工作,但是当我添加第二个时,我收到此错误:

/usr/bin/ld: cannot find : No such file or directory
collect2: ld returned 1 exit status
make: *** [libmylib.so] Error 1
Run Code Online (Sandbox Code Playgroud)

我可以就我做错的事情得到一些帮助吗?

c++ eclipse linux linker gcc

2
推荐指数
1
解决办法
2971
查看次数