I am newbee c programmer so be patient. I have a MSP430 C project in Code Composer Studio 7.3 using windows 7. My project (USB) was working fine and then I tried to add more code to incorporate a SPI interface and everything went sideways. I restored my original code but now have problems that weren't there before. Seems to compile but has several unresolved symbols errors in the linker (I think). I have searched/researched many answers to these types of problems on the forum and tried many things (over the past two days!!) and cannot resolve my problem. Possibly I made things worse by copying library/functions directly into my project directory but still didn't seem to change anything. The errors are related to standard MSP430 functions, not my code. My project tree looks like:
project tree
Errors from Console are:
console errors
From everything I have read it indicates that either I have a compiler library path problem or a linker file path problem. Tried a lot of combinations to no avail. Following are the compiler and linker path info:
linker 1
linker 2
If I look in my repository of library stuff downloaded from TI you can see that the dma.h and dma.c files which reference the error message lines in the files are there and I don't understand why the linker can't do its thing.
dma file tree
In the linker under library files I noticed the original libmath.a file didn't point to anything so I found one and added it (not help). Also the libc.a points to a section of 3 directories (different versions of a tool) which each have a different version of libc.a and I think I tried all of them. See below for directories
directories
Any help would be greatly appreciated
A CLUE POSSIBLY: CLUE? In my quest to solve my issues, I created a new CCs project and pasted my main.c file in and then went through a series of compiles solving the errors as the showed up. I was down to one error : can't open source file hal.h. I believe this is a file that was included with the usb example code I started with. After copying it into my project I am back to square on with all the errors listed above. To get here I only needed to point the compiler to driverlib to solve previous errors. The hal.h file seems to only include driverlib.h which is also referenced in my main function so why all the errors??
FIXED BUT WHY!!!
To solve this issue I imported the drivlib directory from the TI repo on my D drive into my project. Now everything compiles. Can anyone tell me why I had to do that given that I had path directives to look on my D drive?? Can it be related to search path length being too long?
Related
Recently I started coding in C and I tried to find a way to compile with notepad++. After thouroughly installing minGW with some basic upgrades I tried to use a specific code that allows me to compile.
This code is can be found on thise webpage:
http://www.thecrazyprogrammer.com/2015/08/configure-notepad-to-run-c-cpp-and-java-programs.html
So you can see what I am trying to do.
However when I try to execute the command, it gives me the warning that several .dll files are missing.
These are the ones: libgmp-10.dll ; libiconv-2.dll ; libmpc-3.dll and libmpfr-4.dll
After some research, I added those files to the bin, lib and libexec folders of the minGW headfolder and it resulted in giving me another missing lib file:
libgcc_s_dw2-1.dll
Ok I added that one too and now it starts over saying it is missing libiconv-2.dll
I added all the folders to my PATH and there is nothing else I can think of that is wrong =(
If u find a solution, please explain it in detail since I am not a programmer and only have little experience with going this 'deep' into files and paths etc ...
Thanks in advance!
Oh I found it myself I think.
I read somewhere that using gcc in stead of g++ could help and after copying the missing files to a bunch of folders it worked :D
I have to migrate an IAR project to Eclipse IDE and GCC compiler.
For that, I do the process step by step, and the first step is to use Eclipse + makefile and IAR compiler.
The compilation is not a problem, I have object files, the problem is during the link, the linker raise a problem:
IAR ELF Linker V7.10.3.6832/W32 for ARM
Copyright 2007-2014 IAR Systems AB.
Fatal error[Li001]: could not open file
"C:\tunk\src\Sources\mirtic_meta_data\mirtic_meta_data.o"
If I change the order of link files, it's not the same file which raises the error. But each time, a letter is missing in the path, and it's the same letter: "r"
here, the file should be in directory "trunk" not "tunk".
I checked, the path is correct when it sent to the linker.
Apparently, it's Windows which can't handle many path. But I don't know how to solve my problem (I tried to put the project near "C:", with no result).
I know there is a solution, because with IAR workbench, I can build a binary file.
I had a very similar problem when using IAR's Eclipse plugin, but for me it was on the compilation step. I had so many include paths that we were overrunning the command length limit. My solution, and maybe it will help you, was to make sure everything built using relative paths instead of absolute paths. In my case, it was a matter of changing the include directories inside of the Eclipse project to specify them as relative paths. I'm not sure if you can accomplish the same thing with your makefile, but hopefully this might help.
I have looked at other similar questions around stackoverflow, but it doesn't seem to work for me. I am trying to compile a code sample, and it needs these header files:
linux/module.h
linux/modversion.h
linux/sched.h
linux/tqueue.h
But I keep getting errors saying that those files can't be found. I know I should add them to the kernel, but can you please guide me through the process and tell me how to get this done. Thanks in advance for any help.
The code sample can be found here.
You probably want to compile kernel source code first, or check if the below path exists
/lib/modules/kernel-version/build
Or more precisely
/lib/modules/`uname -r`/build
Or
path to your kernel build
This is generally the path where your kernel build tree is present.
Needless to say normal gcc based compilation wont work here.
This should get you started
Some of these files are shipped with any linux distro in :
/usr/include/linux/
but if you haven't linux installed in your machine see linux source tree in github repo :
https://github.com/torvalds/linux/tree/master/include/linux
I'm trying to get started on using an ARM STM32F4 Discovery Board and I'm getting some weird compiling errors when using the "GNU Tools" on Windows 8
Currently my code is very simple:
#include "stm32f4xx_conf.h"
int main(void)
{}
This compiles using the "make" command perfectly find on Ubuntu 12 and windows 7, however I get the following error in Windows 8. I installed the same toolchain on all machines.
C:/Program Files (x86)/codesourcery/sourcery g++
lite/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/ld.exe:
error C:\Users\MyName\AppData\Local\Temp\cckUTM2f.o users VFP register
arguments, main.elf does not
I have narrowed down this error down to the flag "-mfloat-abi=hard", which when switched to "-mfloat-abi=soft", lets the code compile, however this conflicts other files that are previously compiled with "-mfloat-abi=hard".
Does anybody know why this would only occur on Windows 8 and how to fix it? If more information is needed, let me know. Sorry in advance if this is a nooby-question as I'm very new to this!
This answer may appear at the surface to be unrelated, but there is an indirect cause of this error message.
First, the "Uses VFP register..." error message is directly caused from mixing mfloat-abi=soft and mfloat-abi=hard options within your build. This setting must be consistent for all objects that are to be linked.
The indirect cause of this error may be due to the Eclipse editor getting confused by an error in the project's ".cproject" file. The Eclipse editor frequently reswizzles file links and sometimes it breaks itself when you make changes to your directory structures or file locations. This can also affect the path settings to your gcc compiler - for a subset of your project's files. While I'm not yet sure of exactly what causes this failure, replacing the .cproject file with a backup copy corrected this problem for me. In my case I noticed .java.null.pointer errors after adding an include directory path. I also found that a different path to the gcc compiler was being used for some of my sources that were local to the workspace, but not all of them. The two gcc compilers were using different float settings for unknown reasons - hence the VFP register error.
I compared the .cproject settings with a older copy and observed differences in entries for the sources causing the trouble - even though the overriding of project settings was disabled. By replacing the .cproject file with the old version the problem went away, and I'm leaving this as a reminder of what happened.
The solution was actually very simple, it was related to the PATH variable not being set correctly by the toolchain's installer. To solve it in windows 8, go to Environment Variables => System Variables and I added "C:\Program Files (x86)\GNU Tools ARM Embedded\4.8 2014q1\bin" to the path variable. The installer had put it under "User Variables for Name" and that, forever reason, didn't work.
I'm getting some kind of linking error with a program utilizing MS-s waveform API. The code I'm using can be found here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=4422&lngWId=3
It's the first bit of code on the page under the heading "Opening the Sound Device". I'm not getting any errors with the code, however my linker complains quite persistently. The output being the following:
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\crt2.o:crt1.c|| undefined reference to `SetUnhandledExceptionFilter#4'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\crt2.o:crt1.c|| undefined reference to `ExitProcess#4'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\crtbegin.o:cygming-crtbegin.c|| undefined reference to `GetModuleHandleA#4'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\crtbegin.o:cygming-crtbegin.c|| undefined reference to `GetProcAddress#8'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualQuery#12'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualProtect#16'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\libmingw32.a(pseudo-reloc.o):pseudo-reloc.c|| undefined reference to `VirtualProtect#16'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `cmshared_get_ptr_from_atom':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|91|undefined reference to `GetAtomNameA#12'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `_cmshared_create_or_grab':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|140|undefined reference to `FindAtomA#4'|
d:\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\libgcc.a(cygming-shared-data.o)||In function `cmshared_add_ptr_as_atom':|
c:\crossdev\b4.4.1-tdm-1\build-sjlj\mingw32\libgcc\..\..\..\..\gcc-4.4.1\libgcc\..\gcc\config\i386\cygming-shared-data.c|118|undefined reference to `AddAtomA#4'|
||=== Build finished: 10 errors, 0 warnings ===|
I can paste the build log here as well if need be. Could anybody let me know what I need to do to fix this? Or even better, how to troubleshoot it myself so I can fix future problems like this myself?
[EDIT]: Okay so I managed to solve this. While playing around in Project->Build Options->Linker Settings->Link Libraries I noticed that if I add something like kernel32.lib I get an error from ld saying "cannot find -lkernel32.lib". So I searched around till I found the libraries I required and I added absolute paths to them, and now my project compiles flawlessly! :D However this was kind of strange since I did add my library search path and it didn't seem to help. So I went over it again to see why it didn't seem to work and it seems like one has to add a trailing backslash to the path name, like if the libraries are located in "C:\SDK\Lib\" one has to add the trailing slash for Code::BLocks to search it correctly. Once that was fixed I changed the option in Linker Settings->Link Libraries to kernel32 as was recommended and now it works without a hitch.
Thanks to everybody who helped me out with this!!! ^_^
I got the same errors when I place a library into system32 and try to link to it with LIBS += L$$quote(C:/Windows/System32).
When I placed it into a normal directory and set the relative path to it, everything works alright.
Looks like you are not linking with Kernel32.lib Check your project properties.
I'd the same problem and after some time I figured out how to do it, the problem relies on the linker, it's trying to link some windows functions into the exe file, and the compiler cannot find those, this is how I solved this:
Install the Windows 7 SDK, you can download it from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3138
Add the library path to the search libraries on CodeBlocks
Project / Build Options (select The project if you want to link it to all the configurations you have) / Search Directories / Linker / Add and place the SDK Library path, which should be at: C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib
Add the references to the windows libraries on the linker settings:
Project / Build Options / Linker Settings / Add (at Link Libraries) and add kernel32, user32 and gdi32 (this last one should be added if you're using windows gui).
That's it... now rebuild your project and it should work flawlessly.
Note: You need to add this settings to the exe project, if you're creating libraries the error will be shown when try to link the exe file.