-
09-02-2015
#1
Registered User
fatal error: wchar.h: no such file or directory
Hi guys, I am really struggling to setup my code::blocks. It is giving me the same error when I try to compile using minGW through the command line. I have
reinstalled my windows and have not been able to compile any form of
c++ yet.I get on both ways of compiling the following error: fatal error: wchar.h: no such file or directory. I have google the error and reinstalled code blocks with no avail.
I would appreciate any help I
can get at this point.
Please guys
-
09-02-2015
#2
C++ Witch
Are you sure you installed a Code Blocks binary release with MinGW included?
What program did you attempt to compile? I would create a project and try with:
and if that works, try:
Code:
#include <iostream> int main() { std::cout << "Hello world!" << std::endl; }Originally Posted by Bjarne Stroustrup (2000-10-14)
I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. «Finding the smallest program that demonstrates the error» is a powerful debugging tool.
Look up a C++ Reference and learn How To Ask Questions The Smart Way
-
09-02-2015
#3
Registered User
Yes, That was my first thing I did. As the first try i did was a huge fiddly project I’ve been working on I went back to a simple «Hello world» app in both compilers with no luck. I will make sure of the code blocks though. But I installed Code blocks and minGW separately. Like usual.
*edit : just checked I did install a code blocks binary with minGW included. SO tecnically minGW is installed twice now.
-
09-02-2015
#4
C++ Witch
Originally Posted by Cyberduke
But I installed Code blocks and minGW separately. Like usual.
What do you usually do to install MinGW?
Originally Posted by Bjarne Stroustrup (2000-10-14)
I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. «Finding the smallest program that demonstrates the error» is a powerful debugging tool.
Look up a C++ Reference and learn How To Ask Questions The Smart Way
-
09-02-2015
#5
Registered User
I download the minGW installer and install from there. I then add the directory to the environment variables directly. Has never failed me.
-
09-02-2015
#6
Registered User
Post a build log in code tags.
FAQ-Compiling (errors) — CodeBlocks
Tim S.
«…a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match..» Bill Bryson
-
09-02-2015
#7
Registered User
Originally Posted by Cyberduke
I download the minGW installer and install from there. I then add the directory to the environment variables directly. Has never failed me.
I would suggest (with Code::Blocks NOT running) to delete the MinGW folder inside the Code::Blocks installation folder.
Then, startup Code::Blocks and do an compiler auto-detect.FYI: Two installation of MinGW can interfere with each other if one or more of them is in the system environment path variable.
Or, if the MinGW installation folder is in certain folders.Edit2: I believe Code::Blocks will try to use the MinGW in the sub-folder; but, the other MinGW might be causing problems removing one of them will reduce the likelihood of conflicts.
Tim S.
Last edited by stahta01; 09-02-2015 at 07:08 PM.
«…a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match..» Bill Bryson
-
09-03-2015
#8
Registered User
Originally Posted by stahta01
I would suggest (with Code::Blocks NOT running) to delete the MinGW folder inside the Code::Blocks installation folder.
Then, startup Code::Blocks and do an compiler auto-detect.
Tim S.Thank you, I’ve just tried that but it is still not finding the wchar.h file.
-
09-03-2015
#9
Registered User
Originally Posted by stahta01
Code:
-------------- Build: Debug in ggg (compiler: GNU GCC Compiler)--------------- mingw32-g++.exe -Wall -fexceptions -g -c C:UsersIanDesktopgggmain.cpp -o objDebugmain.o In file included from c:mingwlibgccmingw324.8.1includec++bitspostypes.h:40:0, from c:mingwlibgccmingw324.8.1includec++iosfwd:40, from c:mingwlibgccmingw324.8.1includec++ios:38, from c:mingwlibgccmingw324.8.1includec++ostream:38, from c:mingwlibgccmingw324.8.1includec++iostream:39, from C:UsersIanDesktopgggmain.cpp:1: c:mingwlibgccmingw324.8.1includec++cwchar:44:19: fatal error: wchar.h: No such file or directory #include <wchar.h> ^ compilation terminated. Process terminated with status 1 (0 minute(s), 0 second(s)) 1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
-
09-03-2015
#10
C++まいる!Cをこわせ!
Originally Posted by Adak
io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
Originally Posted by Salem
You mean it’s included as a crutch to help ancient programmers limp along without them having to relearn too much.
Outside of your DOS world, your header file is meaningless.
-
09-03-2015
#11
At the risk of sounding like a broken record, I’ve had good experiences with MinGW-W64 builds. Usually you’d want to pick the threads-posix + seh variant on Windows. You just extract the contents into a directory (like C:>mingw-w64 avoid spaces to be safe). Then you add the bin subdirectory to your PATH variable and you’re ready to go. I reckon running Code::Blocks’ auto detection should work with it.
-
09-03-2015
#12
Registered User
No idea if Code::Blocks auto detection will work with mingw-builds MinGW-W64 or not.
But, it works with the TDM installer without many problems.
TDM can install either MinGW32 or MinGW64. TDM-GCC MinGW Compiler download | SourceForge.netDirections to compiler configuration Installing a supported compiler — CodeBlocks
Tim S.
Last edited by stahta01; 09-03-2015 at 03:15 PM.
«…a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match..» Bill Bryson
-
09-04-2015
#13
Registered User
Originally Posted by stahta01
Excelent. I have uninstalled everything I had. And installed TDM and a compiler less code::blocks. Linking everything manually (it said it auto found but still gave a error that no compiler found, weird). I now am able to compile through code Blocks.
One question though. When I try to compile using command line now I get errors that will suggest I am giving the instructions wrong. Despite the fact that i’m doing it in the manner its been working before. How does it look like when you guys use command line compiling?
-
09-04-2015
#14
Registered User
Originally Posted by Cyberduke
Excelent. I have uninstalled everything I had. And installed TDM and a compiler less code::blocks. Linking everything manually (it said it auto found but still gave a error that no compiler found, weird). I now am able to compile through code Blocks.
One question though. When I try to compile using command line now I get errors that will suggest I am giving the instructions wrong. Despite the fact that i’m doing it in the manner its been working before. How does it look like when you guys use command line compiling?
I do NOT use command line compiling, very often, so I can NOT really help you. But, asking for help with TDM using command line might be worse than asking for help using mingw-builds MinGW-W64. I think more people on this site use a non TDM version of MinGW-W64. There has been complaints about TDM doing changes that affect the command line options on the CB site.
Tim S.
«…a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match..» Bill Bryson
-
09-05-2015
#15
Registered User
Originally Posted by stahta01
I do NOT use command line compiling, very often, so I can NOT really help you. But, asking for help with TDM using command line might be worse than asking for help using mingw-builds MinGW-W64. I think more people on this site use a non TDM version of MinGW-W64. There has been complaints about TDM doing changes that affect the command line options on the CB site.
Tim S.
Ahh that is quite disappointing. But thank you anyway.
хидеры тут нашел
/usr/local/include/wx-2.8/wx/
один фиг, если явно указать g++ откуда хидеры подключать — те же ошибки
как исправить проблему с wx-config
Источник
“.h: No such file or directory” – 2 Easy fixes to Arduino error
It’s 11 PM on a Wednesday. You’ve just spent three hours toiling on your next Arduino project, and FINALLY, you’re ready to give your sketch a whirl. You hit upload, palms sweaty with anticipation to see all your hard work come to fruition. It’s then you see the error:
No such file or directory.
Surely this is a chance aberration. “Nothing to worry about,” you mutter, sleep-starved and semi-delirious as you hit upload again. And once more, those maddening words, “no such file or directory,” stare back at you in hostile gaslighting mockery.
Have you been here?
If you’re trying to run an Arduino sketch but keep coming across the “no such file or directory” error, don’t worry. This is actually a pretty common problem, and there are two easy fixes that almost always work.
Keep on reading. We’ll show you what they are.
No such file error!
Error messages can be such a pain. They do, however, serve a useful purpose by telling us something about what went wrong. At first glance, the no such file or directory error is particularly maddening because it seems to break that useful purpose rule. Of course there’s a file or directory! You just made the thing, and it’s right there, tucked inside a directory.
But hold up, let’s take a closer look. If you look at the bottom portion of the Arduino IDE where the error message shows up, there’s this handy little button that says “copy error messages.”
Click on that now. You probably won’t fall off your chair to learn that by clicking that button, you just copied the error message from the little window at the bottom of The Serial Monitor’s UI to the clipboard of your computer.
This copy feature is ridiculously useful. You could, for example, paste the error message into Google and learn more about the error. Or you could take advantage of the active Arduino community by asking for help in a forum. For this situation, however, we can be a bit more basic. All we’re going to do is take a closer look at what the message is actually saying. To do that, just fire up your PC’s text editor and paste it into the blank screen.
Decoding the no such file error
Here it is, that pesky error in all its freshly pasted glory.
I’ll break it down for you line by line.
- The first line is easy. It’s just describing the Arduino version in use, what operating system is running, and which board you have selected.
- Line 2 begins to zero in on the problem.
- The first bit, “knob,” is referring to the name of the program. This is your sketch, basically.
- The second bit is what usually begins to confuse people, but it’s easy once you know. The “10” in this example is telling you the error occurred on line 10 of your sketch. The “19” is telling you the length of the line of code in spaces and characters. The first number is usually the more helpful of the two because you can use it to locate the error in your sketch.
- Then we get to the smoking gun of the error. It says, “servo.h: No such file or directory”.
So this thing, “Servo.h.” That’s the thing we need to fix, and thanks to line 2, we know where to find it. Line 10. It’s always line 10.
Now that we know what’s going on a bit better, let’s get down to the business of implementing a fix.
The error of our ways
Let’s lay down some scrutiny on this accursed line 10.
It says “#include ”
When we verify this code, this line is telling the Arduino IDE compiler, “Hey, for this program to work, you need to go get this file called servo.h”.
Let’s say you had a label-making machine, and you wanted to use it to print some cool motivational labels, like “Success!” and “Keep Trying!” and “Look, Nachos!” To make that happen, you’ll first have to load in a roll of labels. No roll of labels? Well, then the label maker isn’t gonna work.
The sketch you’re trying to upload is like the label maker. The file (in our example, the file named “servo.h”) is the roll of labels.
So the error message actually is saying something useful. It’s saying, “Hey programmer, you said I needed this other file. Well, I looked for it and it’s not there. What gives?”
Now we know the error message isn’t complete gibberish, let’s look at the two most common scenarios that cause it.
Scenario 1 – Fat fingers
This sketch is one that you’ve written. You’re actually the one who wrote the “#include” line. The first thing you should check is your spelling and capitalization. Maybe you spelled the name of the library incorrectly? Or (as with the example below) perhaps you capitalized the wrong letters.
So “servo.h” should actually have a capital “S.” In full and with correct capitalization, it should read, “Servo.h.” You’ll notice above that the word servo changes color when it’s correctly capitalized. That color change signifies that the library name “Servo” is recognized as a “keyword” in the Arduino IDE.
Keep in mind that might not be the case for all the libraries you’re using. In other words, the color change won’t always indicate you’re using the right spelling or capitalization, but it’s often a helpful visual reminder.
Oh, and it’s probably good to mention that everyone in the history of Arduino programming has misspelled or incorrectly capitalized a word at some point. It’s amazing how long you can stare at a line of code and miss something like that.
So don’t sweat it.
Scenario 2 – Missing files
This brings us to the next common scenario for the “no such file or directory” error.
So often, working with Arduinos involves taking code that someone else has developed and shared online and then tailoring it to your project. That’s part of what makes it so easy to get stuff done with Arduino. One problem that frequently happens when we do that, however, is we accidentally introduce code without a matching file.
An easy way to check to see if you have the file a sketch is looking for is to navigate to Sketch > Include Library from within the Arduino IDE. Then look for the name of that library.
Whatever library the #include statement was calling for, you want to look through this big long list for a library with the exact same name. If you don’t see the file name there, this means the library isn’t installed. You’ll have to add that library before the sketch will compile without errors.
So, how do you add that library?
The easiest way is to go to Sketch > Include Library > Manage Libraries. The Arduino IDE will open up a dialogue box from which you can search for the library you need.
Make sure you type the exact word that matches the #include line. Once you find the missing library, go ahead and click Install. The Arduino IDE will let you know that it’s installing the library you requested and updating the software accordingly.
Next, just double-check that the library has been successfully installed by going to Sketch > Include Library. You should see your new library in the dropdown list.
Good news! If the library is there, you should now be able to compile your sketch error-free.
Other library locations
OK, there’s one little fly in the ointment. How do these dang ointment flies always manage to complicate things so?
Here’s the thing. Not all libraries live in this convenient pop-up window inside the Arduino IDE. The Arduino community is bubbling with clever ideas, but cleverness (unlike processed cheese) doesn’t always come in conveniently standardized, individually wrapped slices. There are tons of different ways to find Arduino libraries on the web.
If you’re downloading or copying a program from the internet, just go to the page where you got that program and take a close look at the library the author is referencing. They may, for example, have a link to GitHub, which is a place where people keep a lot of code libraries.
Wherever you find it, usually the library will be included in a .zip file package. Once you’ve downloaded the .zip file, fire up the Arduino IDE and go to Sketch > Include Library > Add .ZIP library. Then navigate to the location you downloaded the file and select it. Assuming no additional ointment flies invade your workflow, the Arduino IDE will pop up the message “Library added to your libraries” just above the dark area where the original “no such file or directory” error appeared.
Now it’s business as usual! Just go to Sketch > Include Library, and the new library will appear in the drop-down list.
As the dyslexic Frenchman once said to the oversized violinist: “Viola!”
You now know not one but two ways to add a new library. What a time to be alive!
Review
A quick recap, then.
We’ve looked at the two main scenarios that cause the “no such file or directory” error to appear after you compile your sketch:
- The fat fingers phenomenon: Check your spelling and capitalization! If you wrote the sketch, there’s a mighty good chance you introduced a tiny error. And don’t beat yourself up over it! Literally every coder has done this.
- The missing files mixup: Failing that, if you copied code from someone else check that you have the correct libraries installed. Don’t see your library? Install it using the method described above, and you should be good to go.
There may be no such thing as a free lunch, a coincidence, or a luck dragon. But rest assured. Your files and directories? They’re alive and well.
Michael James
Proud Member of
The Programming Electronics Academy
The place where we help you get started and scale the mountain of knowledge of the Arduino Platform. That means we teach what is practical , what is useful , and what will get you off to a running start.
Learn more About Us Here
Are you ready to use Arduino from the ground up?
(without spending days going down YouTube rabbit holes)
- Learn the 2 most important Arduino programming functions
- Get familiar with Arduino coding
- Understand your Arduino hardware
- Learn the Arduino software setup
- 12 engaging video lessons
Should you decide to sign up, you’ll receive value packed training emails and special offers.
Wait for it. we’ll be redirecting you to our Training Portal
24 Comments
Great video showing how to include libraries and search libraries if you don’t see a library in your sketch book.
Please keep up the great work. Making Arduino code writing easier.
Thanks,
Jack Brockhurst
Thanks Jack! We’ll do our best to keep them coming.
Great tips! thanks for the tutorials.
Thanks Daniel! I am glad it was helpful.
Tutorials are very comprehensive! Thanks!!
Thank you Juven! I am glad they helped!
Very clear and helpfull
Thanks ! !
Hi, I have the same problem: no such file or directory when trying to run ‘Keypad’, so I noticed it wasn’t written in orange.
I see that I didn’t have it in my library (closest thing was Keyboard) so I went to the library manager and downloaded it.
This time it’s in orange, ran the code again, same message. (. )
Tried to put the code in by clicking on it from the Sketch –> Include etc, and a weird thing happens: first row: #include written in black, and second row: #include written in orange.
I’m trying to use it for a 4×4 keypad
Same. Did you find the fix already?
// reset ESP8266 WiFi connection AT+CIPMUX=1 AT+CWJAP
String cmd=”AT+CWJAP=”, EngineersGarage “,”01234567672″”;
lcd.print(” SENDING DATA”);
lcd.print(” TO CLOUD”);
// TCP connection AT+CIPSTART=4,”TCP”,”184.106.153.149″,80
String cmd = “AT+CIPSTART=4,”TCP”,””;
cmd += “184.106.153.149”; // api.thingspeak.com
String getStr = “GET /update?api_key=”;
// send data length
// thingspeak needs 15 sec delay between updates
in this program i got an error expected initializer before string constant
Liquid crystal _I2C.h :No such file or directory
Did all thibg but it is not happening
Arduino: 1.8.15 (Mac OS X), Board: “Arduino Uno”
Multiple libraries were found for “Usb.h”
checkm8-a5:4:10: fatal error: Constants.h: No such file or directory
Used: /Users/sana/Documents/Arduino/libraries/USB_Host_Shield_2.0
#include “Constants.h”
^
compilation terminated.
Not used: /Users/sana/Documents/Arduino/libraries/USB_Host_Shield_Library_2.0
Not used: /Users/sana/Documents/Arduino/libraries/USBHost
exit status 1
Constants.h: No such file or directory
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Looks like you may not have your Constants.h file in your sketch folder?
j’ai suivi la démarche a la lettre mais je ne suis pas arrivé
a trouver la bibliothèque RFID.
avez vous une idée ou je peux la trouver
merci
I followed the process to the letter but I did not arrive
find the RFID library.
do you have an idea where i can find it
thank you
Is there a specific RFID library you are working with? Do you have a link to its GitHub repo by chance?
I am having trouble with the Radiohead RFM95 encrypted client example, seems Speck.h shows as no such file or directory. I can find code for Speck.h but not as a file I can drop in my library. I imagine there is a way to create the right file type in VS but I am not familiar with how to do that, assuming that would even do the trick. I would appreciate a little help here as I am rather new to Arduino and C++.
Here is the sample library:
// LoRa Simple Hello World Client with encrypted communications
// In order for this to compile you MUST uncomment the #define RH_ENABLE_ENCRYPTION_MODULE line
// at the bottom of RadioHead.h, AND you MUST have installed the Crypto directory from arduinolibs:
// http://rweather.github.io/arduinolibs/index.html
// Philippe.Rochat’at’gmail.com
// 06.07.2017
#include
#include
#include
RH_RF95 rf95; // Instanciate a LoRa driver
Speck myCipher; // Instanciate a Speck block ciphering
RHEncryptedDriver myDriver(rf95, myCipher); // Instantiate the driver with those two
float frequency = 868.0; // Change the frequency here.
unsigned char encryptkey[16] = <1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16>; // The very secret key
char HWMessage[] = “Hello World ! I’m happy if you can read me”;
uint8_t HWMessageLen;
void setup()
<
HWMessageLen = strlen(HWMessage);
Serial.begin(9600);
while (!Serial) ; // Wait for serial port to be available
Serial.println(“LoRa Simple_Encrypted Client”);
if (!rf95.init())
Serial.println(“LoRa init failed”);
// Setup ISM frequency
rf95.setFrequency(frequency);
// Setup Power,dBm
rf95.setTxPower(13);
myCipher.setKey(encryptkey, sizeof(encryptkey));
Serial.println(“Waiting for radio to setup”);
delay(1000);
Serial.println(“Setup completed”);
>
void loop()
<
uint8_t data[HWMessageLen+1] = <0>;
for(uint8_t i = 0; i 
OK, here is what I did to get it compiling.
I went here: https://github.com/kostko/arduino-crypto
And downloaded that library, unzipped it into my Arduino/libraries folder, and renamed the enclosing folder to from arduino-crypto-master to just Crypto.
(the Arduino IDE library manager gave me a different library than that it seems – which didn’t have the Speck.h file)
Then, as per the comments in your sketch, I uncommented that line in the RadioHead.h file (it was like ALL the way at the bottom – a couple lines up)
Then I was able to verify this sketch ok.
sketch_oct15a:5:31: fatal error: LiquidCrystal_I2C.h: No such file or directory
#include
compilation terminated.
exit status 1
LiquidCrystal_I2C.h: No such file or directory
Sir I am facing this problem whenever I am trying to upload this program – Arduino 1.8.19 with “NodeMCU 1.0(ESP-12E Module)”-ESP8266 Boards (2.5.2)
Have you installed the LiquidCrystal_I2C library?
To install it, in the Arduino IDE you would go to “Tools > Manage Libraries” and then search for that library and click install.
I still have this error! I did 10-check, and nothing! Keypad.h is orange, it’s like Arduino sees it, but NO! I have this error:
Arduino: 1.8.12 (Windows 10), Board: “Arduino Uno”
swanky_juttuli1:1:10: fatal error: Keypad.h: No such file or directory
exit status 1
Keypad.h: No such file or directory
This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.
Help me please.
Hmmm – do you have multiple keypad libraries installed?
Источник
Adblock
detector
Hi
I’ve been using my Macbook to code in C++ without a problem. I’ve used XCode, the terminal command and Sublime Text 2, but since the OS update i’m no longer able to compile with any of these.
Whenever I compile with the terminal via the command:
g++ (full path)/filename.cpp
or Sublime Text 2, I get this error message:
In file included from /usr/local/include/c++/4.9.0/bits/postypes.h:40:0,
from /usr/local/include/c++/4.9.0/iosfwd:40,
from /usr/local/include/c++/4.9.0/ios:38,
from /usr/local/include/c++/4.9.0/ostream:38,
from /usr/local/include/c++/4.9.0/iostream:39,
from /Users/gustavoh/Desktop/racionales.cpp:2:
/usr/local/include/c++/4.9.0/cwchar:44:19: fatal error: wchar.h: No such file or directory
#include <wchar.h>
^
compilation terminated.
[Finished in 0.1s with exit code 1]
[shell_cmd: g++ «/Users/gustavoh/Desktop/racionales.cpp» -o «/Users/gustavoh/Desktop/racionales»]
[dir: /Users/gustavoh/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
It obviously has something to do with the libraries used, although it tells me that the wchar.h can’t be found when I used the iostream.
When I try and compile on XCode i get this:
Ld /Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzgvc ypauorfcdop/Build/Products/Debug/Practica normal x86_64
cd /Users/gustavoh/Desktop/Practicas
setenv MACOSX_DEPLOYMENT_TARGET 10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/ SDKs/MacOSX10.9.sdk -L/Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzg vcypauorfcdop/Build/Products/Debug -F/Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzg vcypauorfcdop/Build/Products/Debug -filelist /Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzgvc ypauorfcdop/Build/Intermediates/Practicas.build/Debug/Practica.build/Objects-nor mal/x86_64/Practica.LinkFileList -mmacosx-version-min=10.9 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzgvc ypauorfcdop/Build/Intermediates/Practicas.build/Debug/Practica.build/Objects-nor mal/x86_64/Practica_dependency_info.dat -o /Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzgvc ypauorfcdop/Build/Products/Debug/Practica
duplicate symbol _main in:
/Users/gustavoh/Library/Developer/Xcode/DerivedData/Practicas-ggnlrsbtysthuzgvc ypauorfcdop/Build/Intermediates/Practicas.build/Debug/Practica.build/Objects-nor mal/x86_64/File-D5875A67BE70BB81.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas on how to solve this?
Anybody with the same problem as me
FYI’s:
- Install directory: C:CodeBlocks
- OS: Windows 8.1 x64
- Installed C::B with MinGW: Yes (So C:CodeBlocksMinGW is the compiler path)
- MinGW Tree: http://pastebin.com/hTuVvyc3
- Project is a new console application, C++, with just the basic default hello world program
- There is a lot of information and methods already tested, so please read everything.
Let’s get to it:
Fresh install, nothing changed in the compiler settings, on build&run:
mingw32-g++.exe -Wall -fexceptions -g -c C:CodeBlocksProjectsCppLearningmain.cpp -o objDebugmain.o
mingw32-g++.exe: error: CreateProcess: No such file or directory
So I do about an hours worth of google searching and stock exchange searches and find nothing, except the wiki page on Vista and MinGW, and it looks to have my exact problem, so I follow the instructions until this step:
Still in the Compiler and Debugger dialogue go to «Search directories» -> «Compiler» and add:
C:MinGWinclude
C:MinGWincludec++MinGW-Version
C:MinGWincludec++MinGW-Versionbackward
C:MinGWincludec++MinGW-Versionmingw32
C:MinGWlibgccmingw32MinGW-Versioninclude
So I start to delve into the path of these files but includec++ doesn’t exits…. Stumped, I look for where ever iostream is located, which happens to be at:
C:CodeBlocksMinGWlibgccmingw324.7.1includec++
So I add this path to the search directory in the compiler settings, and out come more errors:
C:CodeBlocksMinGWlibgccmingw324.7.1includec++/iostream:39:28: fatal error: bits/c++config.h: No such file or directory
Do a quick search for c++config.h, and add this path to the search directories:
C:CodeBlocksMinGWlibgccmingw324.7.1includec++mingw32
Guess what? New error!
C:CodeBlocksMinGWlibgccmingw324.7.1includec++/cwchar:46:19: fatal error: wchar.h: No such file or directory
So now I added the path to wchar.h to the search directories(It had two paths, so I added both):
C:CodeBlocksMinGWlibgccmingw324.7.1includec++tr1
C:CodeBlocksMinGWinclude
New missing file, so we add it’s path to(stddef.h):
C:CodeBlocksMinGWlibgccmingw324.7.1include
Boom! This is the dead end, here is a pastebin to the current error (It’s large so it gets a pastebin):
http://pastebin.com/frEXi5SB
Update 1: After doing a cross-check between my search directories and the wiki’s list, I noticed I was missing a backward path, so I searched for the folder and added it to my search directories:
C:CodeBlocksMinGWlibgccmingw324.7.1includec++backward
Same error as the pastebin.
Disclaimer: Sorry if I’m throwing a lot of useless information at you guys, I’m just trying to give you as much information as I know/have done. Please don’t redirect me to other forum posts or stack exchanges, because I’ve probably read them. And sorry if this is on the wrong fourm/sub-forum.









