所以我试图在c中第一次使用方法,当我编译时,我得到这个作为输出
gcc -o methodtest methodtest.o
methodtest.o: In function `main':
methodtest.c:(.text+0x47): undefined reference to `pritnf'
collect2: ld returned 1 exit status
make: *** [methodtest] Error 1
Run Code Online (Sandbox Code Playgroud)
代码看起来像这样
void main(void)
{
int num, num2, num3;
num = 3;
num2 = 2;
num3 = 1;
int ans = addem(num, num2, num3);
pritnf("%d\n", ans);
}
int addem(int num, int num2, int num3)
{
return(num+num2+num3);
}
Run Code Online (Sandbox Code Playgroud)
为什么我得到这个错误或者它是什么?
我的网络应用程序中有一个PHP警告.我有点像菜鸟.我想根据每个用户配置文件中的'adjusttimezone'整数在'更新'时间戳中添加时区偏移量?
这是代码:
$timezonequery = mysql_query('SELECT adjusttimezone FROM members WHERE member_id=' . $_SESSION["myid"]);
$timezone = (int)mysql_result('$timezonequery', 0);
$updatedquery = mysql_query('SELECT DATE_ADD(updated, INTERVAL ' . $timezone . ' HOUR) FROM projects WHERE project_id=' . $i);
Run Code Online (Sandbox Code Playgroud)
它有效,但我担心这个警告:
警告:mysql_result():提供的参数不是第9行xxx.php中的有效MySQL结果资源
有人可以帮忙吗?谢谢
我有以下代码与结构数组与数据进行一些计算.当我编译代码时,我得到了消息[Warning] converting to 'int' from 'double'
.我想用代码解决这个问题,但我不确定问题出在哪里.我不确定这个警告是否太大了,但我认为这种转换可能会导致我的计算出现一些差异.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
int i,aplha[90],beta[90];
double gamma[90],delta[90],epsilon[90],zeta[90];
struct wmm
{
int alpha;
int beta;
double gamma;
double delta;
double epsilon;
double zeta;
}book[]={
{1, 0, -29496.6, 0.0, 11.6, 0.0},
{1, 1, -1586.3, 4944.4, 16.5, -25.9},
{2, 0, -2396.6, 0.0, -12.1, 0.0},
{2, 1, 3026.1, -2707.7, -4.4, -22.5},
{2, 2, 1668.6, -576.1, 1.9, -11.8},
{3, 0, 1340.1, 0.0, 0.4, 0.0},
{3, 1, -2326.2, -160.2, -4.1, …
Run Code Online (Sandbox Code Playgroud) 此脚本适用于带有-w
交换机的localhost,但不是没有.当它也可以use strict
和use warning
活跃.
的Apache2/error.log中:
没有开关(中止脚本):
(2)No such file or directory: exec of ... failed
Run Code Online (Sandbox Code Playgroud)
我得到的开关:
Use of uninitialized value $email_flag in string ne ...
Run Code Online (Sandbox Code Playgroud)
看起来很像我.
在实时Web服务器上都没有人工作.Perl对我来说很新,但我知道一些BASH和PHP.
我运行Debian Lenny,Apache2,Perl 5.10.
#!/usr/bin/perl -w
$| = 1;
my $mailprog = '/usr/sbin/sendmail'; # where the mail program lives
my $to = "not\@for.you"; # where the mail is sent
my ($command,$email,@pairs,$buffer,$pair,$email_flag) ;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
# Split the pair up into …
Run Code Online (Sandbox Code Playgroud) 我正在尝试完成Perl的大学任务,我们的教授告诉我们使用:
use strict;
use warnings;
Run Code Online (Sandbox Code Playgroud)
随着use strict;
我的代码完美的作品.有use warnings;
,但是,我的代码喷出所有这些东西到SDOUT,我不知道为什么(或如何关闭它).我的相关代码是:
while($diff =~ /^(\d+)((,){1}(\d+))?([adc])(\d+)((,){1}(\d+))?/mgi) {
# This line is used for debugging the $diff regular expression scalars.
# print "\n1: $1\t2: $2\t 3: $3\t4: $4\t5: $5\t6: $6\t7: $7\t8: $8\t9: $9\n";
$difflinestotal += ($4 - $1) unless $4 == "";
$difflinestotal += ($9 - $6) unless $9 == "";
$difflinestotal += 1 if (($4 == "") && ($9 == ""));
}
Run Code Online (Sandbox Code Playgroud)
有了警告,它会在输出中间吐出:
Argument "" isn't numeric in numeric eq (==) …
Run Code Online (Sandbox Code Playgroud) 嗨,我正在用linux下的stdlib编程.
gcc针对以下代码行发出以下警告,任何想法为什么会这样?
FILE *fd;
if ( fd = fopen( filename, "rw" )== NULL )
{
Run Code Online (Sandbox Code Playgroud)
并且警告是:
warning: assignment makes pointer from integer without a cast.
Run Code Online (Sandbox Code Playgroud)
如何实现这一点,根据stdlib文档,fopen的返回类型是FILE*.那么为什么还有警告?有什么想法吗?
- 提前致谢 -
在没有正文的情况下编译while循环时,我看到了这样的消息:
warning: suggest a space before ';' or explicit braces around empty body in
'while' statement
Run Code Online (Sandbox Code Playgroud)
我为什么要放一个空间?它是否更清楚我的循环没有真正做任何事情?
我有一个C linux函数,它具有以下代码:
void A (char *s1, char *s2)
{
...
*s2 = NULL;
...
}
Run Code Online (Sandbox Code Playgroud)
在这个函数中我将值放入s2,最后放入NULL.
代码:
*s2 = NULL
Run Code Online (Sandbox Code Playgroud)
生成以下警告:赋值从指针生成整数而不进行强制转换
我想修复我的代码,我该怎么做?
谢谢
我正在执行代码:
<?php
$input="ABC123";
$splits = chunk_split($input,2,"");
foreach($splits as $split)
{
$split = strrev($split);
$input = $input . $split;
}
?>
Run Code Online (Sandbox Code Playgroud)
我想要的输出是:
BA1C32
Run Code Online (Sandbox Code Playgroud)
但它给了我警告.
Warning: Invalid argument supplied for foreach() in /home/WOOOOOOOOHOOOOOOOO/domains/badhamburgers.com/public_html/index.php on line 4
Run Code Online (Sandbox Code Playgroud) 当使用XCode 4.2编译crypto ++时,我收到多个警告,"extern模板的所有实例都是c ++ 11扩展".这意味着什么,这会影响输出可执行文件的兼容性?