小编Kim*_*sen的帖子

更改为c ++ 11后无法使用srand48()

为什么我无法将代码编译为c ++ 11并使用srand48函数?

我有一个程序,我可以在其中使用一些矩阵.问题是当我用-std=c++0x标志编译代码时.我想使用一些仅限c ++ 11的函数,这是我的方法.如果我没有指定c ++版本,它编译没有任何问题.像这样:

g++ -O2 -Wall test.cpp -o test -g
Run Code Online (Sandbox Code Playgroud)

如果我误解了上述标志的作用,请纠正我.

我在Windows 7 64位机器上运行我的代码并通过cygwin进行编译.我使用g ++版本4.5.3(GCC).如果需要更多信息,请评论.

由于某些未知原因(甚至对我自己),我的所有代码都写在一个编译单元中.如果错误是由结构错误引起的,那么您也应该随意指出它.:)

我收到以下错误:

g++ -std=c++0x -O2 -Wall test.cpp -o test -g

test.cpp: In function ‘void gen_mat(T*, size_t)’:
test.cpp:28:16: error: there are no arguments to ‘srand48’ that depend on a template parameter, so a declaration of ‘srand48’ must be available
test.cpp:28:16: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name …
Run Code Online (Sandbox Code Playgroud)

cygwin g++ srand c++11

5
推荐指数
1
解决办法
4876
查看次数

从URL中删除index.php导致yii中的404

问题

最初的问题: 您好我有一个新建的Yii网站,我想从URL中删除index.php.
示例:"/ index.php/site/index"应为"/ site/index"

我一直在使用这个http://www.yiiframework.com/doc/guide/1.1/en/topics.url#hiding-x-23x指南,但我只收到404.

我希望你能指出一个错误或帮我调试这个问题!
如果我遗漏了任何相关信息,请告诉我.

OBS:"主页"页面按预期工作,其他页面被破坏.

问题的状态: 看起来这是mod_rewrite.so的apache/ubuntu问题

回答

在得到不同人的帮助后,它现在全部工作了:DI必须安装"重写"才能让它运行,我通过编写运行a2enmod重写这样做我的系统的下面配置解决了我的问题,我希望这个线程能帮助其他人类似的问题.

我的系统

Server version: Apache/2.2.22 (Ubuntu)  
Server built:   Nov  8 2012 21:37:45
Run Code Online (Sandbox Code Playgroud)

Apache httpd.conf

<Directory "/var/www/MY_SITE/FOLDER_CONTAINING_YII/">
AllowOverride All
#...
</Directory>
LoadModule rewrite_module modules/mod_rewrite.so
Run Code Online (Sandbox Code Playgroud)

这是文件的全部内容

Apache错误日志

File does not exist: /.../htdocs/site, referer: http://.../htdocs/index.php/site/index  
Run Code Online (Sandbox Code Playgroud)

我加了点

重启Apache

kah@webaalborg:/etc/apache2/sites-available$ sudo service apache2 restart
 * Restarting web server apache2 
[Mon Nov 26 20:16:35 2012] [warn] module rewrite_module is already loaded, skipping
  ... waiting 
[Mon Nov 26 20:16:36 2012] [warn] module …
Run Code Online (Sandbox Code Playgroud)

php apache ubuntu yii

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

标签 统计

apache ×1

c++11 ×1

cygwin ×1

g++ ×1

php ×1

srand ×1

ubuntu ×1

yii ×1