Dev c ошибка при компиляции

8 / 8 / 5

Регистрация: 07.12.2014

Сообщений: 73

1

27.02.2015, 16:59. Показов 9668. Ответов 11


Студворк — интернет-сервис помощи студентам

Здравствуйте, у меня есть ошибка с комплиации в dev c++, ОС Windows 8.1 Профессиональная

Миниатюры

Ошибка компиляции в Dev C++
 



0



55 / 56 / 34

Регистрация: 29.12.2012

Сообщений: 478

27.02.2015, 17:08

2

А код ошибки то и не показали….
return 0;-попробуйте добавить



0



41 / 41 / 26

Регистрация: 24.02.2015

Сообщений: 151

27.02.2015, 17:08

3

Попробуй добавить return 0;
И покажи код ошибки(кликнуть по «показать подробности проблемы»)



1



55 / 56 / 34

Регистрация: 29.12.2012

Сообщений: 478

27.02.2015, 17:12

4

Не по теме

Цитата
Сообщение от MakeEasy
Посмотреть сообщение

Попробуй добавить return 0;
И покажи код ошибки(кликнуть по «показать подробности проблемы»)

Гении мыслят одинаково



1



8 / 8 / 5

Регистрация: 07.12.2014

Сообщений: 73

27.02.2015, 17:18

 [ТС]

5

Добавил return 0; Тоже дает одинаковый ошибку

Рисунок

Ошибка компиляции в Dev C++



0



41 / 41 / 26

Регистрация: 24.02.2015

Сообщений: 151

27.02.2015, 17:27

6

Наверное, кривая сборка dev c++. Попробуй переинсталить.



0



8 / 8 / 5

Регистрация: 07.12.2014

Сообщений: 73

27.02.2015, 17:34

 [ТС]

7

Я установил dev c++ 4.9.9 dev и c++ 5.3, я тоже думал что некоторые компоненты не установился, и потом установил Visual studio 2012 и Visual Studio 2013. Не помогло. Потом я установил эти сборки на другом компьютеры на который установленоWindows XP и Windows 7. У них работал.



0



41 / 41 / 26

Регистрация: 24.02.2015

Сообщений: 151

27.02.2015, 17:49

8

Может быть это косяк Windows 8. В любом случае проблема здесь не в коде. Так что надо эксперементировать. Отключить антивирусник, переустановить компилятор, библиотеки.



0



быдлокодер

1723 / 910 / 106

Регистрация: 04.06.2008

Сообщений: 5,666

27.02.2015, 18:00

9

Если поможет- ось почему-то палит компилятор. ТС:
1) Создать файл «cmd.bat» содержания «cmd»
2) Создать файл «file.cpp» содержащий код
3) Запихать «cmd.bat» и «file.cpp» в папку с «g++.exe», последний должен находиться в папке «Dev-CppMinGW32bin»
4) Ткнуть на файл «cmd.bat»
5) В появившемся окне скомандовать: g++ file.cpp
6) Результаты сюда.



0



0 / 0 / 0

Регистрация: 10.01.2015

Сообщений: 1

27.02.2015, 18:13

10

Erkin надо устанавить оs windows 7 ))))



0



быдлокодер

1723 / 910 / 106

Регистрация: 04.06.2008

Сообщений: 5,666

27.02.2015, 18:20

11

Цитата
Сообщение от Britanik
Посмотреть сообщение

Erkin надо устанавить оs windows 7

Если уж так, то XP (на чём и работаю). Но мы должны найти в чём именно плоха windows 8, поэтому будем разбирать всё предметно.



1



8 / 8 / 5

Регистрация: 07.12.2014

Сообщений: 73

27.02.2015, 19:03

 [ТС]

12

Друзья, все работал спасибо за внимание. Обновил систему и переустановил dev c++



0



Dev C++, created by Bloodshed programming, is a free IDE for programming in C/C++. It works with Windows 7, 8 and 10 and can be used to compose Windows or control centre based C/C++ programs effectively, and you can also make an installer for your application.

In this article, we’re going over what is the Dev C++ build error, and quick fixes for the error.


What is the Dev C++ build error?

Build represents a compilation of the code. If the code is built successfully, it is now executable and does not have any errors. An error is the illicit use of commands or operations, leading to abnormal functionality. An error prevents the code from being built or compiled and hence becomes non-executable.

There are five different types of errors commonly seen in C/C++.

  • Syntax error
  • Run-time error
  • Linker error
  • Logical error
  • Semantic error

The syntax error is also known as compilation error or build error.


Syntax errors

Syntax errors occur due to a violation of the basic rules or syntax for writing the code in the C/C++ language. This error prevents the code from getting compiled. All the syntax errors detected by the compiler need to be resolved for the code to compile successfully.

The most common syntax errors are forgetting to put a semicolon, incorrect number of parenthesis and using a variable without the declaration, among others.

How to fix Dev C++ build error?

Note the words failed and Error 1 in the snipped above. This indicates that the code ran into a build error.

Also read: How to create a project in Dev C++?


Ensure that the version being used is the latest and is supported by your device.

The first step to follow when a build error occurs is to check the errors and the lines where it is happening. Then, under the Compiler tab in the bottom panel, the error message is mentioned alongwith the line number.

How to fix Dev C++ build error?

Follow the message and attempt to debug the code. The error in the above snippet is expected ‘;’ before return, which indicates that the 6th line is missing a semicolon.


Paranthesis

Build errors may occur due to the incorrect opening/closing of the parenthesis or an incorrect number of them. Always make sure that function calls like main(), or any other user-defined function has the opening and closing brackets next to them with or without the parameters in them depending on the type of function.

When writing a conditional statement like if, if-else, for, switch, while and others, double-check the number of opening parenthesis. Nested loops might often have a confusing set of brackets. Always keep practising making both the start and end set of parenthesis when starting a new loop.


Spell check

While coding, the spellings of variables, functions, methods, and keywords often go wrong and sometimes may not be detected as a spelling error in the console, which makes it tricky to fix the errors. C/C++ is a case-sensitive language.

All user-defined variables, functions and methods must be called in the same case for the code to build error-free. Try to keep the names of variables and functions easy to remember, something meaningful to its function in the code and not very complicated in terms of the casing.


Semicolon

Forgetting a semicolon is one of the worst nightmares of any coder. The absence of a single semicolon can prevent the entire program from building.

If the semicolon is missed within a loop, it can cause many more errors that may make no sense. Ensure to insert a semicolon after every single line of code, with the given exceptions of functions and beginnings of loops.


Data type

Every initialised variable and user-defined function has a specific data type. Data types include int or integer, str or string, float and many others. Using the wrong data type under these variables can cause the entire program to break down.

When writing a command for taking input or initialising the values for the variables, double-check the originally initialised data type for it. If the function is an array or tuple, or dictionary, check all the individual parameters before calling them.


Syntax

While C and C++ are both similar and can be written in the same software, there are a few key differences in the syntax of the two languages. For instance, the commands for input and output in C are scanf and print; on the other hand, cin and cout are C++ commands.

Writing a C code in C++ and vice-versa often leads to syntax errors that may be correct in the other language. Always use syntax for the language in which the file/project was created.

Another important aspect of the syntax is the include files. There are specific header files to be written initially in the code to use specific functions like input-output, mathematical functions and others. The absence of header files prevents the function from being verified and used; hence the build may fail.

Also read: How to add a header file in Dev C++?

After some investigation, and with Dr.Topaz’s help, I have learned that you will want to confirm that the program set for g++ in the Compiler Options really does compile the source code. In my case, the C:Dev-Cppbing++.exe program did not create an exe, but the C:Dev-Cppbinc++.exe program did. Either program appears to be intended to take the same arguments and options as GNU g++. I would love to find an actual doc on the Dev-C++ compiler programs, but I have not so far.

You can test the compiler program with a simple example like this:

C:Dev-Cppbinc++.exe hello.cpp -o hello.exe

Currently in 2021, the Dev-C++ site invites you to download either original Dev-C++ or a newer fork by a group named Embarcadero.

I decided to try the Embarcadero version and the experience was slightly better. The UI is still a tad dated, but the g++.exe program it came with was able to compile programs without issue. Again, take note of where the program is being installed, but in my case, the Embarcadero compiler programs were in C:Program Files (x86)EmbarcaderoDev-CppTDM-GCC-64bin.

Both original Dev-C++ and Embarcadero come with mingw-32 versions of the compiler programs that from what I see do work in a Git Bash console, with slight differences such as not recognizing a default locale when using the command std::cout.imbue(std::locale("")).

Dev-C++ is a popular Integrated Development Environment (IDE) for C and C++ programming languages. It provides a user-friendly interface and simplifies the compilation and debugging process for developers. However, sometimes you may encounter the «Source File Not Compiled» issue while trying to build your project. This documentation will guide you through the process of troubleshooting and resolving this issue step-by-step.

Table of Contents

  • Check Your Build Settings
  • Verify Your Code
  • Check Your Compiler Installation
  • Update Dev-C++
  • FAQ

Check Your Build Settings

The first step in resolving the «Source File Not Compiled» issue is to ensure your build settings are correctly configured. Here’s how:

  1. Open Dev-C++ IDE and load your project.
  2. Go to the Tools menu and click on Compiler Options.
  3. In the General tab, make sure the TDM-GCC 64-bit Release is selected under Compiler Set.
  4. In the Directories tab, verify that the Include and Lib directories are correctly set. The default paths should be:
Include: C:Program Files (x86)Dev-CppMinGW64include
Lib: C:Program Files (x86)Dev-CppMinGW64lib
  1. Click OK to save your settings and try rebuilding your project.

Verify Your Code

The «Source File Not Compiled» issue can also arise due to errors in your source code. To ensure there are no errors:

  1. Check your code for any syntax or logical errors.
  2. Make sure you’ve included all necessary header files.
  3. Ensure that you’ve properly closed all open brackets, parentheses, and braces.
  4. Check for any missing semicolons at the end of statements.
  5. Use the Build menu to compile your code or press F9 to ensure there are no errors.

If your code still doesn’t compile, move on to the next step.

Check Your Compiler Installation

A faulty or incomplete compiler installation could also cause the «Source File Not Compiled» error. To check your compiler installation:

  1. Go to the Dev-C++ installation directory (e.g., C:Program Files (x86)Dev-Cpp).
  2. Open the MinGW64 folder and ensure that the bin, include, and lib folders are present.
  3. In the bin folder, check if the gcc.exe, g++.exe, and mingw32-make.exe files are present.

If any of these files are missing, you may need to reinstall Dev-C++ to fix the problem.

Update Dev-C++

Outdated versions of Dev-C++ may cause compilation issues. Make sure you’re using the latest version of Dev-C++ by following these steps:

  1. Open Dev-C++ and go to the Help menu.
  2. Click on Check for Updates.
  3. If an update is available, follow the prompts to download and install it.
  4. Restart Dev-C++ and try compiling your project again.

FAQ

Q: What is the latest version of Dev-C++?

A: As of the time of writing, the latest stable version of Dev-C++ is 5.11. You can download it from the official website.

Q: Can I use Dev-C++ for other programming languages?

A: While Dev-C++ is primarily designed for C and C++ languages, it also supports other languages like Fortran, Ada, D, and others through the use of external compilers.

Q: How do I change the default compiler in Dev-C++?

A: Go to Tools > Compiler Options and select the desired compiler set from the drop-down menu in the General tab.

Q: Can I use Dev-C++ on macOS or Linux?

A: Dev-C++ is a Windows-only application. However, you can use alternatives like Code::Blocks or Eclipse CDT on macOS and Linux.

Q: How do I create a new project in Dev-C++?

A: Go to File > New > Project, choose the desired project type, and follow the prompts to set up your new project.

  • Dev-C++ Official Website
  • Code::Blocks — A Cross-platform IDE for C/C++
  • Eclipse CDT — C/C++ Development Tooling for Eclipse

I want to use «Dev-C++» for compile c++ codes.
So I download and install it, and write this code:

#include <iostream.h>

main () {
     cout << "124";
}

but when I compiled it, it said:

In file included from
E:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,
from [myfile path]Untitled1.cpp:1:
E:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2:
warning: #warning This file includes
at least one deprecated or antiquated
header. Please consider using one of
the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting the header
for the header for C++ includes,
or instead of the
deprecated header . To
disable this warning use
-Wno-deprecated.

After I saw errors, I change my code to this code:

#include <iostream>

main () {
     cout << "124";
}

but it said again that errors.

I compile first code easily in Turbo C++, BUT in Dev-C++ …

What can I do?

Понравилась статья? Поделить с друзьями:
  • Connection timeout как исправить ошибку
  • Deep rock galactic сессия закончена ошибка
  • Connection refused connect ошибка сервера
  • Dead rising ошибка при запуске приложения 0xc0000142
  • Connection failed after 4 retries css ошибка