标签: dev-c++

代码仍然运行没有任何包含(Bloodshed的Dev-C++)

我目前正在学习和试验C,并使用Bloodshed的DEV-C++作为IDE.

现在,我刚刚意识到下面的一段代码(因为它是......不包括或没有)编译和运行:

main ()
{
    printf("%d", strlen("hello"));  
}
Run Code Online (Sandbox Code Playgroud)

现在,如果我没有弄错的话,不应该在这个源中包含两个头文件以使其工作吗? stdio.hstring.h...但正如你所看到的,我没有添加它们,代码仍然编译并成功运行.

我的抱怨是我希望编译器"严格",因为因为我还在学习C,所以我不希望代码在正常情况下运行.

那么,有没有什么方法可以防止Dev-C++在纠正我的错误时使用它include,即使它更加"严格"?

c include header-files dev-c++

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

Code :: Blocks/Dev-c ++:错误:iostream:没有这样的文件或目录

我从这里下载了Code :: Blocks:http://www.codeblocks.org/downloads/26

我正在学习c编程.当我运行以下程序时,我收到错误:

iostream: No such file or directory
error: syntax error before "namespace"
warning: type defaults to `int' in declaration of `std'
warning: data definition has no type or storage class
In function `main':
error: `cout' undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: `cin' undeclared (first use in this function)
Run Code Online (Sandbox Code Playgroud)

我正在运行以下程序:

#include <iostream>
using namespace std;

int main()
{
  int …
Run Code Online (Sandbox Code Playgroud)

c++ dev-c++

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

C++未定义的引用?

所以这是我的程序的一部分,我无法调用函数,我真的需要一些帮助.它基本上是选择任一功能并输入数据,然后打印该数据.我做错了什么?请帮助,我一直在努力

"[链接器]引用Customer_Record()'" , [Linker error] undefined reference to Car_Record()'和'ld返回1退出状态"

 #include <stdio.h>
 #include <string.h>  
 #include <stdlib.h>
 #include <windows.h>  
 #include <conio.h>

void Customer_Record(), Car_Record();
int num;

struct Customer {
    char customer_ID[20];
    int license;
    char address[20];
    int phone;
    char email[20];
} cust;

struct car {

    int regno[20];
    char model[20];
    char colour[10];
} car;


main() {
    printf("               Enter 1 to go to Customer Record \n\n");
    printf("               Enter 2 to go to Car Record \n\n");
    scanf("%d", &num);
    if (num = 1) {
        Customer_Record(); …
Run Code Online (Sandbox Code Playgroud)

c++ dev-c++

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

不同的电脑不同输出

我在我的WxDev C++上编译了这段代码.从理论上讲,它应该输出用户的答案和正确的答案.除了coranswers数组的数组0之外,它只显示了一个空格.我尝试在其他PC上编译它,问题不存在.我尝试重新安装WxDev,即使用代码块替换它也是如此.好像问题就在我的电脑上.我该怎么办?

#include<stdio.h>
int main(){
char coranswers[20] = {'A', 'B', 'C', 'D', 'E', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A'};
char answers[20];
int count;
int grade = 0;

for(count = 0; count < 20; count++){
          printf("No.%d ", count+1);
          scanf("%s", &answers[count]);
          }
for(count = 0; count < 20; count++){
          printf("No.%d ", count+1);
          printf("Your answers : %c\n", answers[count]);
          if(answers[count] == coranswers[count]){
                            grade++;
                            }
          else{
               printf("Wrong answer, correct answer is %c\n", coranswers[count]);
          }
          }
          return …
Run Code Online (Sandbox Code Playgroud)

c arrays dev-c++

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

C++ string!= string

我刚刚开始使用C++并且有一些C#的经验,所以我总体上有一些编程经验.然而,似乎马上就被击落了.我试过在Google上寻找,以免浪费任何人的时间无济于事.

int main(int argc, char *argv[])
{
    HANDLE  hConsole;
    int k = 5;
    string h;
    string password = "pass";

    hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole, k);
    SetConsoleTextAttribute( GetStdHandle( STD_INPUT_HANDLE ), 0x5B );

    while (h != password)
    {
        printf("This PC is locked\nEnter the password to gain access\n");
        scanf("%s", &h);
    }

    printf("\n");
    system("PAUSE");
    return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)

每当我运行它,它将让我输入密码,当我点击输入它将确认然后崩溃要求我调试或发送信息给微软.当我添加while循环检查两个字符串时,这开始了.我是否正确地执行了此操作或者我错过了什么?

以防万一不清楚.我希望程序将字符串与输入进行比较,如果它们都相同,则程序将结束.

谢谢你的期待.

c++ console dev-c++

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

分段错误/ Dev C崩溃

嘿伙计,所以我想做一个功课,我不能整天找到我的程序上的致命错误.让我解释一下:首先,你给出行数,col然后数组的单元格(只有"."免费空间和"*"表示矿井,所有行都没有空格)然后发生崩溃.

main(){
    int  i,col,row,count,N,M,j;
    char **p;
    printf("Give number of rows\n");
    scanf("%d",&N);
    printf("Give number of columns\n");
    scanf("%d\n",&M);
    p=malloc(N*sizeof(char *));   //Saving room for the array
    if (p==NULL)
        return -1;
    for (i=0;i < N ; ++i){
        p[i] = malloc (M * sizeof(char));
        if (*(p+i) == NULL)
            return -1;
    }
    for (i=0; i< N;++i){
        for ( j = 0 ; j < M ;++j)
            scanf("%c",&p[i][j]); //Insert "*" for mines and the rest with "."
    }
    for (row=1; row<= N;++row){           //Here the things get messy …
Run Code Online (Sandbox Code Playgroud)

c dev-c++ minesweeper

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

C++错误:ISO C++禁止指针和整数之间的比较[-fpermissive]

我是初学者C++程序员,对C++知之甚少.我已经在IDE和编译器上创建了一个程序:Dev-C++ 5.6.3.我遇到了这个错误:ISO C++禁止指针和整数之间的比较[-fpermissive].我不知道这意味着什么,但我会把整个代码放在这里:

#include <iostream>
#include <stdio.h>
#include <cstdlib>
#include <conio.h>

using namespace std;
// This is the Cleaner and Updated version of the test program.

int main(int argc, char** argv) {

Introduction: //Introduction to The Program and Little Information About it.
cout << "________________________________________________________________________________" << endl;
cout << "                     Introduction                        " << endl;
cout << "________________________________________________________________________________" << endl;
cout << "Welcome to Ryan's C++ Program" << endl;
cout << "This Program is in Beta and is Glitchy" << endl; …
Run Code Online (Sandbox Code Playgroud)

c++ shutdown dev-c++

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

使用fopen()创建文件

我只是创建一个基本的文件处理程序.代码是这样的:

#include <stdio.h>
int main()
{
FILE *p;
p=fopen("D:\\TENLINES.TXT","r");
if(p==0)
{
    printf("Error",);

}

fclose(p);
}
Run Code Online (Sandbox Code Playgroud)

这是给错误,我无法创建文件尝试重新安装编译器和使用不同的位置和名称的文件,但没有成功.我使用的是Windows 7,编译器是Dev C++版本5

c file-handling dev-c++ null-pointer

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

C-Socket编程-《未定义的引用》

我是 C 套接字编程的初学者。我在书中得到了代码,当我编译时,这些是以下带有未定义引用的错误。请给一个提示来纠正这个问题!谢谢!

代码:

#include <stdio.h>
#include <winsock.h>
#include <winsock2.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define RCVBUFSIZE 32
int main(int argc, char *argv[]){
int sock;
struct sockaddr_in echoServAddr;
unsigned short echoServPort;
char *servIP;
char *echoString;
char echoBuffer[RCVBUFSIZE];
unsigned int echoStringLen;
int bytesRcvd, totalBytesRcvd;
if(argc>3 || argc>4){
    printf("Usage: %s <Server IP> <Echo Word> [<Echo Port>\n",argv[0]);
    exit(1);
}
servIP=argv[1];
echoString=argv[2];
if(argc==4){
    echoServPort=atoi(argv[3]);
}
else{
    echoServPort=7;
}
if((sock=socket(PF_INET,SOCK_STREAM,IPPROTO_TCP))<0){
    printf("socket() failed!");
}
memset(&echoServAddr,0,sizeof(echoServAddr));
echoServAddr.sin_family=AF_INET;
echoServAddr.sin_addr.s_addr=inet_addr(servIP);
echoServAddr.sin_port=htons(echoServPort);
if (connect(sock, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) …
Run Code Online (Sandbox Code Playgroud)

c sockets tcpclient dev-c++ undefined-reference

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

错误:g++.exe:没有这样的文件或目录 g++.exe:致命错误:Visual studio 代码中没有输入文件?

我的代码中没有错误,并且我在环境变量中配置了Mingw ,但显示此错误。我已经在Dev C++中创建了这个文件,并且在其中运行良好。错误是:

g++.exe: error: Calculator: No such file or directory
g++.exe: error: .cpp: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
Run Code Online (Sandbox Code Playgroud)

我已插入图像以供参考。
在此输入图像描述

我在Visual Studio Code中创建的文件运行良好,我尝试将此文件的代码复制到一个新文件中并运行。那么我应该对使用 Dev C++ 创建的所有文件执行此操作还是有其他方法可以解决此问题?

c++ mingw dev-c++ visual-studio-code

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