Author Topic: CodeBlocks 10.05 - 'system' was not declared in this scope  (Read 34987 times)

rantic

  • Guest
CodeBlocks 10.05 - 'system' was not declared in this scope
« on: June 03, 2010, 01:05:10 am »
Hi everyone,

I have been teaching myself to program in C++ for a few months now using Code::Blocks 8.02 and decided to upgrade to 10.05 today when I saw it on the website.

I uninstalled 8.02 in add/remove programs before installing 10.05. Unfortunately after launching 10.05 for the first time (without a hitch) I opened up a few of my old C++ projects to fiddle with and noticed they no longer compile.

Here are my compile errors for basically every program.

Code
C:\Users\meta\Documents\My Dropbox\school\semester 2\comp1200 - c++\Assignments\assignment_1\assignment_1.cpp||In function 'int main()':|
C:\Users\meta\Documents\My Dropbox\school\semester 2\comp1200 - c++\Assignments\assignment_1\assignment_1.cpp|63|error: 'system' was not declared in this scope|
C:\Users\meta\Documents\My Dropbox\school\semester 2\comp1200 - c++\Assignments\assignment_1\assignment_1.cpp||In function 'void printResults(std::string, int, int, double, double)':|
C:\Users\meta\Documents\My Dropbox\school\semester 2\comp1200 - c++\Assignments\assignment_1\assignment_1.cpp|135|error: 'system' was not declared in this scope|
C:\Users\meta\Documents\My Dropbox\school\semester 2\comp1200 - c++\Assignments\assignment_1\assignment_1.cpp|136|error: 'exit' was not declared in this scope|
||=== Build finished: 3 errors, 0 warnings ===|

I tried to google this and some said it might be using the Microsoft Visual C++ Compiler, but from what I can tell looking in the options it isn't. I also searched this forum and found a post (link below) but it didn't really provide any helpful information on how to get this fixed. Any information would be gladly appreciated!

http://forums.codeblocks.org/index.php/topic,12513.0.html

Code::Blocks Version: 10.05
Operating System: Windows 7 - 64bit
« Last Edit: June 03, 2010, 01:07:34 am by rantic »

Offline kencamargo

  • Multiple posting newcomer
  • *
  • Posts: 110
Re: CodeBlocks 10.05 - 'system' was not declared in this scope
« Reply #1 on: June 03, 2010, 05:52:13 pm »
Here are my compile errors for basically every program.

This means that some #include file where those symbols were defined/declared is not being included. Make sure that you have all the directories specified in the "search directories" tab, in the section related to the compiler.

Ken

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7592
    • My Best Post
Re: CodeBlocks 10.05 - 'system' was not declared in this scope
« Reply #2 on: June 03, 2010, 07:03:56 pm »
Turning on Full Compiler Logging might help find out what is wrong.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Remember to do it for the compiler you are using.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline infinigon

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: CodeBlocks 10.05 - 'system' was not declared in this scope
« Reply #3 on: June 03, 2010, 11:24:01 pm »
Have you included <cstdlib>? Both exit and system are defined there, and seeing as you're getting no other errors (e.g. related to cout) that omission could well be the problem.